Re: [HACKERS] Planning time in explain/explain analyze

2014-01-29 Thread Andreas Karlsson
On 01/28/2014 09:39 PM, Tom Lane wrote: I'm for doing the measurement in ExplainOneQuery() and not printing anything in code paths that don't go through there. Reading the discussion here and realizing that my last patch was wrong I am now in agreement with this. I have attached a patch which

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-29 Thread Robert Haas
On Wed, Jan 29, 2014 at 2:21 PM, Andreas Karlsson andr...@proxel.se wrote: On 01/28/2014 09:39 PM, Tom Lane wrote: I'm for doing the measurement in ExplainOneQuery() and not printing anything in code paths that don't go through there. Reading the discussion here and realizing that my last

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-29 Thread Andreas Karlsson
On 01/29/2014 09:01 PM, Robert Haas wrote: Cool. I propose adding one parameter rather than two to ExplainOnePlan() and making it of type instr_time * rather than passing an instr_time and a bool. If you don't want to include the planning time, pass NULL; if you do, pass a pointer to the

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-29 Thread Robert Haas
On Wed, Jan 29, 2014 at 3:13 PM, Andreas Karlsson andr...@proxel.se wrote: On 01/29/2014 09:01 PM, Robert Haas wrote: Cool. I propose adding one parameter rather than two to ExplainOnePlan() and making it of type instr_time * rather than passing an instr_time and a bool. If you don't want to

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-29 Thread Andreas Karlsson
On 01/29/2014 10:10 PM, Robert Haas wrote: Committed with minor doc changes. Thanks! /Andreas -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-28 Thread Robert Haas
On Thu, Jan 9, 2014 at 11:45 PM, Tom Lane t...@sss.pgh.pa.us wrote: Greg Stark st...@mit.edu writes: On Thu, Jan 9, 2014 at 9:14 PM, Tom Lane t...@sss.pgh.pa.us wrote: In short then, I think we should just add this to EXPLAIN and be done. -1 for sticking the info into PlannedStmt or anything

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-28 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Thu, Jan 9, 2014 at 11:45 PM, Tom Lane t...@sss.pgh.pa.us wrote: Uh, no, wasn't my suggestion. Doesn't that design imply measuring *every* planning cycle, explain or no? I was thinking more of just putting the timing calls into explain.c. The

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-27 Thread Andreas Karlsson
On 01/13/2014 09:48 PM, Robert Haas wrote: What I'm saying is that if EXPLAIN reports something that's labelled Planning Time, it should *be* the planning time, and not anything else. When we retrieve a plan from cache, it would be sensible not to report the planning time at all, and IMHO it

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-13 Thread Robert Haas
On Thu, Jan 9, 2014 at 11:45 PM, Tom Lane t...@sss.pgh.pa.us wrote: Greg Stark st...@mit.edu writes: On Thu, Jan 9, 2014 at 9:14 PM, Tom Lane t...@sss.pgh.pa.us wrote: In short then, I think we should just add this to EXPLAIN and be done. -1 for sticking the info into PlannedStmt or anything

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-13 Thread Stephen Frost
* Robert Haas (robertmh...@gmail.com) wrote: Currently the patch includes changes to prepare.c which is what seems odd to me. I think it'd be fine to say, hey, I can't give you the planning time in this EXPLAIN ANALYZE because I just used a cached plan and did not re-plan. But saying, hey,

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-13 Thread Andreas Karlsson
On 01/13/2014 09:06 PM, Stephen Frost wrote: My thought, at least, was to always grab the planning time and then provide it for explain and/or explain analyze, and then for re-plan cases, indicate if a cached plan was returned, if a replan happened, and if a replan happened, what the old plan

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-13 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Thu, Jan 9, 2014 at 11:45 PM, Tom Lane t...@sss.pgh.pa.us wrote: Uh, no, wasn't my suggestion. Doesn't that design imply measuring *every* planning cycle, explain or no? I was thinking more of just putting the timing calls into explain.c.

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-13 Thread Robert Haas
On Mon, Jan 13, 2014 at 3:23 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Thu, Jan 9, 2014 at 11:45 PM, Tom Lane t...@sss.pgh.pa.us wrote: Uh, no, wasn't my suggestion. Doesn't that design imply measuring *every* planning cycle, explain or no? I was

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-13 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Mon, Jan 13, 2014 at 3:23 PM, Tom Lane t...@sss.pgh.pa.us wrote: Meh. Why? This would only come into play for EXPLAIN EXECUTE stmtname. I don't think users would be surprised to see a report of minimal planning time for that. In fact, it might be

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-13 Thread Robert Haas
On Mon, Jan 13, 2014 at 3:40 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Mon, Jan 13, 2014 at 3:23 PM, Tom Lane t...@sss.pgh.pa.us wrote: Meh. Why? This would only come into play for EXPLAIN EXECUTE stmtname. I don't think users would be surprised to

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-09 Thread Stephen Frost
Andreas, Robert, * Andreas Karlsson (andr...@proxel.se) wrote: A patch with updated documentation is attached. Thanks for working on this! On 01/02/2014 04:08 AM, Robert Haas wrote: I'm wondering whether the time should be stored inside the PlannedStmt node instead of passing it around

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-09 Thread Greg Stark
On Thu, Jan 9, 2014 at 1:50 PM, Stephen Frost sfr...@snowman.net wrote: I do not think we want to always measure the time it took to generate a plan due to slow clocks on some architectures. Also I feel that such a patch would be more invasive. The slow-clock argument is really quite

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-09 Thread Tom Lane
Greg Stark st...@mit.edu writes: However I don't see the issue here. Two gettimeofday calls per query plan is not really going to hurt even on systems where it's slow. I tend to agree with this, especially if the calls only occur when the user asks for the information (ie, does an EXPLAIN

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-09 Thread Greg Stark
On Thu, Jan 9, 2014 at 9:14 PM, Tom Lane t...@sss.pgh.pa.us wrote: In short then, I think we should just add this to EXPLAIN and be done. -1 for sticking the info into PlannedStmt or anything like that. I'm confused. I thought I was arguing to support your suggestion that the initial planning

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-09 Thread Tom Lane
Greg Stark st...@mit.edu writes: On Thu, Jan 9, 2014 at 9:14 PM, Tom Lane t...@sss.pgh.pa.us wrote: In short then, I think we should just add this to EXPLAIN and be done. -1 for sticking the info into PlannedStmt or anything like that. I'm confused. I thought I was arguing to support your

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-08 Thread Andreas Karlsson
A patch with updated documentation is attached. On 01/02/2014 04:08 AM, Robert Haas wrote: I'm wondering whether the time should be stored inside the PlannedStmt node instead of passing it around separately. One possible problem with the way you've done things here is that, in the case of a

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-02 Thread Andreas Karlsson
On 01/02/2014 04:08 AM, Robert Haas wrote: I'm wondering whether the time should be stored inside the PlannedStmt node instead of passing it around separately. One possible problem with the way you've done things here is that, in the case of a prepared statement, EXPLAIN ANALYZE will emit the

Re: [HACKERS] Planning time in explain/explain analyze

2014-01-01 Thread Robert Haas
On Sat, Dec 28, 2013 at 11:32 PM, Andreas Karlsson andr...@proxel.se wrote: New version of the patch with updated documentation and which does not display the planning time when the COSTS are off. I will add it to the next commitfest. I'm wondering whether the time should be stored inside the

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-28 Thread Andreas Karlsson
New version of the patch with updated documentation and which does not display the planning time when the COSTS are off. I will add it to the next commitfest. -- Andreas Karlsson diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml new file mode 100644 index 2af1738..240a3d5 ***

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-24 Thread Peter Eisentraut
On 12/23/13, 8:12 PM, Andreas Karlsson wrote: A user asked in -performance[1] if there is a way to measure the planning time. log_planner_stats -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-24 Thread Andreas Karlsson
On 12/24/2013 02:31 PM, Peter Eisentraut wrote: On 12/23/13, 8:12 PM, Andreas Karlsson wrote: A user asked in -performance[1] if there is a way to measure the planning time. log_planner_stats Thanks for the suggestion, I will use that if I need to know the plan times. But I do not think

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-24 Thread Andreas Karlsson
On 12/24/2013 05:09 AM, Robert Haas wrote: Yeah. The alternatives seem to be: 1. Change a lot of regression tests. This would be a serious PITA, not so much for the one-time cost as for every time we needed to back-patch a regression test that includes explain output. -1. 2. Don't display

[HACKERS] Planning time in explain/explain analyze

2013-12-23 Thread Andreas Karlsson
Hi, A user asked in -performance[1] if there is a way to measure the planning time. Other than measuring it in the client I do not think there is so I quickly hacked a patched which adds Planning time to the outputs of EXPLAIN and EXPLAIN ANALYZE. Is this something useful? I think it is,

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-23 Thread Tom Lane
Andreas Karlsson andr...@proxel.se writes: The patch does not include any changes to documentation or tests. I will fix that if people think this patch is useful. I take it you've not tried the regression tests with this. regards, tom lane -- Sent via pgsql-hackers

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-23 Thread Euler Taveira
On 23-12-2013 22:12, Andreas Karlsson wrote: A user asked in -performance[1] if there is a way to measure the planning time. Other than measuring it in the client I do not think there is so I quickly hacked a patched which adds Planning time to the outputs of EXPLAIN and EXPLAIN ANALYZE. Is

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-23 Thread Andreas Karlsson
On 12/24/2013 03:33 AM, Tom Lane wrote: Andreas Karlsson andr...@proxel.se writes: The patch does not include any changes to documentation or tests. I will fix that if people think this patch is useful. I take it you've not tried the regression tests with this. Yeah, forgot to mention that

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-23 Thread Robert Haas
On Mon, Dec 23, 2013 at 9:54 PM, Andreas Karlsson andr...@proxel.se wrote: On 12/24/2013 03:33 AM, Tom Lane wrote: Andreas Karlsson andr...@proxel.se writes: The patch does not include any changes to documentation or tests. I will fix that if people think this patch is useful. I take it

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-23 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Mon, Dec 23, 2013 at 9:54 PM, Andreas Karlsson andr...@proxel.se wrote: Yeah, forgot to mention that we need some way to disable it in the tests. Either by not having it included in EXPLAIN or by adding an option to turn it off. Any suggestion on

Re: [HACKERS] Planning time in explain/explain analyze

2013-12-23 Thread Robert Haas
On Mon, Dec 23, 2013 at 10:47 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Mon, Dec 23, 2013 at 9:54 PM, Andreas Karlsson andr...@proxel.se wrote: Yeah, forgot to mention that we need some way to disable it in the tests. Either by not having it included