Re: So why is EXPLAIN printing only *plan* time?

From: Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: So why is EXPLAIN printing only *plan* time?
Date: 2014-04-28 04:17:44
Message-ID: BF2827DCCE55594C8D7A8F7FFD3AB7713DDE4428@SZXEML508-MBX.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 27 April 2014 22:38, Tom Lane Wrote:

> ... and not, in particular, parse analysis or rewrite time?
>
> I'd been a bit suspicious of the recent patch to add $SUBJECT without
> the other pre-execution components, but it just now occurred to me that
> there's at least one reason why this might be a significant omission:
> any delay caused by waiting to acquire locks on the query's tables will
> be spent in the parser.
>
> It's probably okay to omit raw parsing time (that is, flex+bison), even
> though profiling sometimes suggests that that's a nontrivial cost.
> It's completely predictable and more or less linear in the query string
> length, so there are not likely to be any surprises for users in that
> time. But it's not at all clear to me that the same can be said for
> parse analysis or rewrite times.
>
> Rewrite timing could easily be captured by EXPLAIN since that call is
> done within ExplainQuery(). Parse analysis isn't, but we could imagine
> having transformExplainStmt() time the operation and stick the result
> into a new field in struct ExplainStmt.
>
> I'm not sure if it'd be appropriate to add all of these measurements as
> separate printout lines; arguably we should just fold them into
> "planning time".
>
> Thoughts?

I had understanding that the "Planning time" printed along with EXPLAIN is
only for the purpose to see how much time is spent in creating plan for execution.
If we start including all previous (i.e. parsing + analyzing + rewrite) time also
in "Planning time" then, it might lose whole of the meaning of printing this.

If we add time spent in locking, then "Planning time" for the same query with same statistics
will become variable depending on the amount of time it had to wait to acquire lock, which
will be bit confusing for users.

May be if we really have to print other time (i.e. parsing + analyzing + rewrite), then IMHO
we can print with some different name instead of including in "Planning time" only.

Thanks and Regards,
Kumar Rajeev Rastogi

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-04-28 07:48:30 Re: Decrease MAX_BACKENDS to 2^16
Previous Message Tom Lane 2014-04-28 01:24:44 pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(