0

The documentation clearly states

The Planning time shown by EXPLAIN ANALYZE is the time it took to generate the query plan from the parsed query and optimize it. It does not include parsing or rewriting.

Then how does one get this time which is not included (parsing and rewriting by themsevles)? I understand that one can take the total query time, but beyond that, is it possible to get this time individually in a different way?

The reason I ask is because I am in a situation where I cannot record total time taken (instead I want to arrive at it from the plan, which seems to be missing a bit of info).

baceda9220
  • 41
  • 1
  • 4

1 Answers1

2

I sounds like you want the settings:

log_parser_stats
log_planner_stats
log_executor_stats

The format of the output is not pleasant to dig through, and the volume of output is also very high on a busy server unless you set them only in one session, but I don't think anything else will give you what you want.

To the plan as well, you would probably want to use this in conjunction with auto_explain.

jjanes
  • 37,812
  • 5
  • 27
  • 34
  • that is what I want, but I am understanding that such an option to package the stats with the plan is totally unavailable? not sure how I feel about having to analyze log files for this task – baceda9220 Mar 20 '20 at 22:38
  • I'm not sure what the alternative to log files would be. I would think any client that will let you process the data client side (say, `set client_min_messages TO log` and do something useful with the log messages) would also let you time the query directly. Why can't you time the queries? – jjanes Mar 21 '20 at 00:07