Re: pgsql: Include planning time in EXPLAIN ANALYZE output.

Lists: pgsql-committerspgsql-hackers
From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-01-29 21:10:00
Message-ID: E1W8cOW-0002wI-Ng@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Include planning time in EXPLAIN ANALYZE output.

This doesn't work for prepared queries, but it's not too easy to get
the information in that case and there's some debate as to exactly
what the right thing to measure is, so just do this for now.

Andreas Karlsson, with slight doc changes by me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/9347baa5bbc70368f2f01438bbb8116863dac1ec

Modified Files
--------------
doc/src/sgml/perform.sgml | 27 +++++++++++++++++++++++++++
doc/src/sgml/ref/explain.sgml | 17 ++++++++++++-----
src/backend/commands/explain.c | 24 +++++++++++++++++++++---
src/backend/commands/prepare.c | 2 +-
src/include/commands/explain.h | 4 ++--
5 files changed, 63 insertions(+), 11 deletions(-)


From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Robert Haas <rhaas(at)postgresql(dot)org>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-02-02 11:44:12
Message-ID: CAM3SWZRXpGyz+L4OSYvhTPyf+9D5_3tO7jOxFxb4GekyHEhdJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Wed, Jan 29, 2014 at 1:10 PM, Robert Haas <rhaas(at)postgresql(dot)org> wrote:
> Include planning time in EXPLAIN ANALYZE output.

Isn't it perhaps a little confusing that "Planning time" may well
exceed "Total runtime"? I'm aware that we aren't super clear on the
accounting here generally, as with pg_stat_statements, which doesn't
include planning time in total_time, while we aren't even explicit
about that in the documentation. But even still, seeing the two
side-by-side, with planning time > total runtime did give me pause.

--
Peter Geoghegan


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org, Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Robert Haas <rhaas(at)postgresql(dot)org>, pgsql-committers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-02-02 16:13:54
Message-ID: 8090.1391357634@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Peter Geoghegan <pg(at)heroku(dot)com> writes:
> On Wed, Jan 29, 2014 at 1:10 PM, Robert Haas <rhaas(at)postgresql(dot)org> wrote:
>> Include planning time in EXPLAIN ANALYZE output.

> Isn't it perhaps a little confusing that "Planning time" may well
> exceed "Total runtime"?

Perhaps s/Total runtime/Execution time/ ?

regards, tom lane


From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, Robert Haas <rhaas(at)postgresql(dot)org>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-02-02 20:44:50
Message-ID: CAM3SWZQvmA5mM=8W+BE5-=Nr53Ur029PXd-U17dpQ-JLa45STw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Sun, Feb 2, 2014 at 8:13 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Perhaps s/Total runtime/Execution time/ ?

+1

--
Peter Geoghegan


From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Peter Geoghegan <pg(at)heroku(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, Robert Haas <rhaas(at)postgresql(dot)org>, pgsql-committers(at)postgresql(dot)org
Subject: Re: [HACKERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-02-02 21:11:49
Message-ID: 52EEB495.7040102@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On 03/02/14 09:44, Peter Geoghegan wrote:
> On Sun, Feb 2, 2014 at 8:13 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Perhaps s/Total runtime/Execution time/ ?
> +1
>
>
If the planning was ever made into a parallel process, then 'elapsed
time' would be less than the 'processor time'. So what does 'Execution
time' mean?

Can I assume:
'Total runtime' is 'elapsed time'
and
'Execution time' is 'processor time'.

In a parallel implementation, one would likely want both.

Possible this is not an issue now, and I'm thinking to far ahead!

Cheers,
Gavin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, pgsql-hackers(at)postgresql(dot)org, Robert Haas <rhaas(at)postgresql(dot)org>, pgsql-committers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-02-02 21:53:12
Message-ID: 28293.1391377992@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz> writes:
> Can I assume:
> 'Total runtime' is 'elapsed time'
> and
> 'Execution time' is 'processor time'.

No. It's going to be elapsed time, either way.

> In a parallel implementation, one would likely want both.

When and if we have that, we can argue about what to measure.

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Peter Geoghegan <pg(at)heroku(dot)com>, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-02-03 12:15:32
Message-ID: CA+TgmoY85Kdps6f9W_n105Xpq0apnpJ-=_jMtPBKTRNwTwiORg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Sun, Feb 2, 2014 at 11:13 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Peter Geoghegan <pg(at)heroku(dot)com> writes:
>> On Wed, Jan 29, 2014 at 1:10 PM, Robert Haas <rhaas(at)postgresql(dot)org> wrote:
>>> Include planning time in EXPLAIN ANALYZE output.
>
>> Isn't it perhaps a little confusing that "Planning time" may well
>> exceed "Total runtime"?
>
> Perhaps s/Total runtime/Execution time/ ?

I'm not really feeling a compelling need to change that. We've been
displaying total runtime - described exactly that way - for many
releases and it's surely is confusing to the novice that the time
reported can be much less than the time reported by psql's \timing
option, usually because of planning time. But adding the planning
time to the output seems to me to make that better, not worse. If the
user can't figure out that runtime != planning time, I'm not sure
they'll be able to figure out execution time != planning time, either.

One of the reasons it's called "Total runtime", or so I've always
assumed, is because it's more inclusive than the time shown for the
root node of the plan tree. Specifically, it includes the time
required to fire triggers.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-02-03 23:30:55
Message-ID: CAM3SWZTMzVsYi0yjYg_rnM_oKppPLKYpBMV+x9z-9Wb_jpeN1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Mon, Feb 3, 2014 at 4:15 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> I'm not really feeling a compelling need to change that. We've been
> displaying total runtime - described exactly that way - for many
> releases and it's surely is confusing to the novice that the time
> reported can be much less than the time reported by psql's \timing
> option, usually because of planning time.

I think that has a lot more to do with network roundtrip time and
protocol/serialization overhead.

--
Peter Geoghegan


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-02-03 23:55:28
Message-ID: 24876.1391471728@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Peter Geoghegan <pg(at)heroku(dot)com> writes:
> On Mon, Feb 3, 2014 at 4:15 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> I'm not really feeling a compelling need to change that. We've been
>> displaying total runtime - described exactly that way - for many
>> releases and it's surely is confusing to the novice that the time
>> reported can be much less than the time reported by psql's \timing
>> option, usually because of planning time.

> I think that has a lot more to do with network roundtrip time and
> protocol/serialization overhead.

The problem I'm having with the way it stands now is that one would
reasonably expect that "Total time" is the total of all times counted
by EXPLAIN, including main plan execution time, trigger firing time,
and now planning time. Since it is not, any longer, a total, I think
renaming it would be a good idea. I'm not wedded to "execution time"
in particular, but I don't like "total".

regards, tom lane


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-02-04 00:13:46
Message-ID: 20140204001346.GS2921@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> The problem I'm having with the way it stands now is that one would
> reasonably expect that "Total time" is the total of all times counted
> by EXPLAIN, including main plan execution time, trigger firing time,
> and now planning time. Since it is not, any longer, a total, I think
> renaming it would be a good idea. I'm not wedded to "execution time"
> in particular, but I don't like "total".

Agreed.

Thanks,

Stephen


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Geoghegan <pg(at)heroku(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-04-16 23:24:40
Message-ID: 20140416232440.GQ7443@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Mon, Feb 3, 2014 at 07:13:46PM -0500, Stephen Frost wrote:
> * Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> > The problem I'm having with the way it stands now is that one would
> > reasonably expect that "Total time" is the total of all times counted
> > by EXPLAIN, including main plan execution time, trigger firing time,
> > and now planning time. Since it is not, any longer, a total, I think
> > renaming it would be a good idea. I'm not wedded to "execution time"
> > in particular, but I don't like "total".
>
> Agreed.

Where are we on this? I still see:

test=> EXPLAIN ANALYZE SELECT 1;
QUERY PLAN
------------------------------------------------------------------------------------
Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=1)
Planning time: 0.009 ms
--> Total runtime: 0.009 ms
(3 rows)

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Peter Geoghegan <pg(at)heroku(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-04-16 23:35:58
Message-ID: 18488.1397691358@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Where are we on this? I still see:

> test=> EXPLAIN ANALYZE SELECT 1;
> QUERY PLAN
> ------------------------------------------------------------------------------------
> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=1)
> Planning time: 0.009 ms
> --> Total runtime: 0.009 ms
> (3 rows)

There seemed to be a clear majority of votes in favor of changing it to
say "Execution time". Robert was arguing for no change, but I don't think
that's tenable in view of the fact that the addition of the "Planning
time" line is already a change, and one that makes the old wording
confusing.

I'll go change it.

regards, tom lane


From: Oleg Bartunov <obartunov(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>, Peter Geoghegan <pg(at)heroku(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-04-17 07:41:20
Message-ID: CAF4Au4xzVdWsFrgAH=wHA=cD3AU3N4iKvMZjQK3PAxaR9=YooQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

I found a bit confusing, when planning time is greater total time, so
+1 for execution time.

On Thu, Apr 17, 2014 at 3:35 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> Where are we on this? I still see:
>
>> test=> EXPLAIN ANALYZE SELECT 1;
>> QUERY PLAN
>> ------------------------------------------------------------------------------------
>> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=1)
>> Planning time: 0.009 ms
>> --> Total runtime: 0.009 ms
>> (3 rows)
>
> There seemed to be a clear majority of votes in favor of changing it to
> say "Execution time". Robert was arguing for no change, but I don't think
> that's tenable in view of the fact that the addition of the "Planning
> time" line is already a change, and one that makes the old wording
> confusing.
>
> I'll go change it.
>
> regards, tom lane
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers


From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Peter Geoghegan <pg(at)heroku(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Include planning time in EXPLAIN ANALYZE output.
Date: 2014-04-17 09:53:08
Message-ID: 534FA484.6000900@proxel.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On 04/17/2014 01:35 AM, Tom Lane wrote:
> I'll go change it.

Thanks for fixing this. The new name "Execution time" is much clearer.

--
Andreas Karlsson