pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Plan output: actual execution time not considering loops?
Date: Wed, 20 Jun 2018 10:03:54 -0400
Message-ID: <7416.1529503434@sss.pgh.pa.us> (raw)
In-Reply-To: <c920e568-5b6a-7014-b2a4-6a59c403a704@gmx.net>
References: <c920e568-5b6a-7014-b2a4-6a59c403a704@gmx.net>

Thomas Kellerer <spam_eater@gmx.net> writes:
> Consider the following execution plan:
> ...
>     ->  Aggregate  (cost=26.87..26.87 rows=1 width=32) (actual time=0.012..0.012 rows=1 loops=700000)
>           ->  Bitmap Heap Scan on orders o2  (cost=3.45..26.85 rows=8 width=8) (actual time=0.004..0.008 rows=8 loops=700000)
>                 ->  Bitmap Index Scan on orders_customer_id_order_date_idx  (cost=0.00..3.45 rows=8 width=0) (actual time=0.003..0.003 rows=8 loops=700000)

> My expectation would have been that the "Aggregate" step shows the actual time as a product of the number of loops.

No, that looks fine to me.  The rule of thumb for reading this is total
time spent in/below this node is "actual time" times "number of loops".

It seems a bit odd that the Agg node would account for a third of the
total execution time when it's only processing 8 rows on average ...
but maybe it's a really expensive aggregate.

Another thought is that the EXPLAIN ANALYZE instrumentation itself
can account for significant per-node-invocation overhead.  If the
total execution time drops significantly when you add "timing off"
to the EXPLAIN options, then that's probably a factor in making
the Agg node look relatively expensive.

			regards, tom lane




view thread (3+ messages)  latest in thread

Message-ID: <7416.1529503434@sss.pgh.pa.us>
Permalink:  ../7416.1529503434@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7416.1529503434@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, spam_eater@gmx.net
  Subject: Re: Plan output: actual execution time not considering loops?
  In-Reply-To: <7416.1529503434@sss.pgh.pa.us>
  References: <c920e568-5b6a-7014-b2a4-6a59c403a704@gmx.net> <7416.1529503434@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox