Re: Output affected rows in EXPLAIN

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Output affected rows in EXPLAIN
Дата
Msg-id 1509167.1694008820@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Output affected rows in EXPLAIN  (Damir Belyalov <dam.bel07@gmail.com>)
Ответы Re: Output affected rows in EXPLAIN  (Damir Belyalov <dam.bel07@gmail.com>)
Список pgsql-hackers
Damir Belyalov <dam.bel07@gmail.com> writes:
> I create a patch that outputs affected rows in EXPLAIN that occur by
> INSERT/UPDATE/DELETE.
> Despite the fact that commands in EXPLAIN ANALYZE query are executed as
> usual, EXPLAIN doesn't show outputting affected rows as in these commands.
> The patch fixes this problem.

This creates a bug, not fixes one.  It's intentional that "insert into a"
is shown as returning zero rows, because that's what it did.  If you'd
written "insert ... returning", you'd have gotten a different result:

=# explain analyze insert into a values (1);
                                        QUERY PLAN
------------------------------------------------------------------------------------------
 Insert on a  (cost=0.00..0.01 rows=0 width=0) (actual time=0.015..0.016 rows=0 loops=1)
   ->  Result  (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)
 Planning Time: 0.015 ms
 Execution Time: 0.027 ms
(4 rows)

=# explain analyze insert into a values (1) returning *;
                                        QUERY PLAN
------------------------------------------------------------------------------------------
 Insert on a  (cost=0.00..0.01 rows=1 width=4) (actual time=0.026..0.028 rows=1 loops=1)
   ->  Result  (cost=0.00..0.01 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1)
 Planning Time: 0.031 ms
 Execution Time: 0.051 ms
(4 rows)

Now admittedly, if you want to know the number of rows that went to disk,
you have to infer that from the number of rows emitted by the
ModifyTable's child plan.  But that's a matter for documentation
(and I'm pretty sure it's documented someplace).

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Anthonin Bonnefoy
Дата:
Сообщение: Re: POC: Extension for adding distributed tracing - pg_tracing
Следующее
От: Robert Haas
Дата:
Сообщение: Re: generic plans and "initial" pruning