Planning counters in pg_stat_statements

Thomas Munro <thomas.munro@enterprisedb.com>

From: Thomas Munro <thomas.munro@enterprisedb.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Fujii Masao <masao.fujii@gmail.com>
Date: 2017-11-07T05:10:45Z
Lists: pgsql-hackers

Attachments

Hi hackers,

I have often wanted $SUBJECT and was happy to find that Fujii-san had
posted a patch five years ago[1].  The reception then seemed positive.
So here is a refurbished and (hopefully) improved version of his patch
with a new column for the replan count.  Thoughts?

Example output:

             query              | plans | plan_time | calls | total_time
--------------------------------+-------+-----------+-------+------------
 prepare x as select $1         |     1 |     0.026 |    12 |       0.06
 select substr(query, $1, $2),  |    11 |     1.427 |    11 |      3.565
 prepare y as select * from foo |     2 |     7.336 |     5 |      0.331

I agree with the sentiment on the old thread that
{total,min,max,mean,stddev}_time now seem badly named, but adding
"execution" makes them so long...  Thoughts?

[1] https://www.postgresql.org/message-id/CAHGQGwFx_%3DDO-Gu-MfPW3VQ4qC7TfVdH2zHmvZfrGv6fQ3D-Tw%40mail.gmail.com

-- 
Thomas Munro
http://www.enterprisedb.com

Commits

  1. Allow pg_stat_statements to track planning statistics.