Re: I don't understand that EXPLAIN PLAN timings - Mailing list pgsql-performance

From David Rowley
Subject Re: I don't understand that EXPLAIN PLAN timings
Date
Msg-id CAApHDvqX2qTihLG2K4OqzeRneg3h+bwdgL000SjYHPFKiU7eAA@mail.gmail.com
Whole thread Raw
In response to Re: I don't understand that EXPLAIN PLAN timings  (Jean-Christophe Boggio <postgresql@thefreecat.org>)
Responses Re: I don't understand that EXPLAIN PLAN timings  (Jean-Christophe Boggio <postgresql@thefreecat.org>)
List pgsql-performance
On Tue, 23 Jan 2024 at 20:45, Jean-Christophe Boggio
<postgresql@thefreecat.org> wrote:
> explain says actual time between 1.093→1.388 but final execution time says 132.880ms?!?

The 1.388 indicates the total time spent in that node starting from
just before the node was executed for the first time up until the node
returned no more tuples.

The 132.88 ms is the total time spent to start up the plan, which
includes doing things like obtaining locks (if not already obtained
during planning), opening files and allocating memory for various
things needed for the plan.  After the top-level node returns NULL it
then will print out the plan before shutting the plan down. This
shutdown time is also included in the 132.88 ms.

I don't know where exactly the extra time is spent with your query,
but it must be in one of the operations that I mentioned which takes
place either before the top node is first executed or after the top
node returns NULL.

If you're using psql, if you do \timing on, how long does EXPLAIN take
without ANALYZE? That also goes through executor startup and shutdown.
It just skips the running the executor part.

David



pgsql-performance by date:

Previous
From: Jean-Christophe Boggio
Date:
Subject: Re: I don't understand that EXPLAIN PLAN timings
Next
From: Jean-Christophe Boggio
Date:
Subject: Re: I don't understand that EXPLAIN PLAN timings