Re: pg_stat_statements

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_stat_statements
Date: 2008-06-24 03:14:57
Message-ID: 20080624113235.7445.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:

> I think you want to see the distribution of execution times for
> particular queries without needing to log *every* execution, including
> parameters. I think I understand now what you are asking for and why you
> are asking for it.

Yes. In many case, major influential queries don't depend on thier
parameters. Also, averages of execution time are useful if you want to
log indivisual queries that takes long time compared to the averages.
For example, you can use configuration like:
"If an execution time is 3 times longer than the average of the same plan,
write the explain-tree into log".

That reminds me, it might have association with Auto-explain patch.
Is it given up?
http://archives.postgresql.org/pgsql-patches/2008-01/msg00123.php

> We could also have a function that causes each backend to dump the
> current averages of all plans through to the stats collector, so you can
> assemble a global view. But that should be on-demand, not a continuous
> flow of stats, IMHO.

Hmm, it's interesting idea. It doesn't require any additional shared
memory and max length of stat message would be enough for typical
queries (PGSTAT_MSG_PAYLOAD is 1000 bytes or less). I'm not sure
how to *notify* all backends to send plans to collector, but we could
send plans periodically instead. Bloated pgstat.stat file might be
another problem, and I have no idea about it.

I think the stats collector way is not more than the shared memory way in
efficiency, but it is more flexible. I'll reconsider and compare them...

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2008-06-24 04:38:11 Git Repository for WITH RECURSIVE and others
Previous Message Mark Mielke 2008-06-24 00:19:59 Re: Dept of ugly hacks: eliminating padding space in system indexes