Re: [HACKERS] Planning counters in pg_stat_statements

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Lukas Fittl <lukas(at)fittl(dot)com>
Cc: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [HACKERS] Planning counters in pg_stat_statements
Date: 2018-03-31 01:24:11
Message-ID: CAEepm=3=J-u-1KkacLNEc2K4m2PX3_XDWEjHSb9R-fCTjOt3rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 31, 2018 at 8:04 AM, Lukas Fittl <lukas(at)fittl(dot)com> wrote:
> On Tue, Jan 23, 2018 at 3:31 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>
>> > Unfortunately I'm not going to have bandwidth to figure this out
>> > during this commitfest due to other priorities so I'm going to call
>> > this "returned with feedback".
>>
>> OK. There's still time to get it done in the March 'fest.
>
>
> I've had an interesting incident earlier this week where seeing planning
> time in pg_stat_statements would have been very helpful to determine the
> root cause more quickly.
>
> Essentially the situation was a statement that executed < 1ms but took more
> than 250ms to plan, running often - once we found the statement (using
> pg_stat_activity sampling) we were able to fix quickly by rewriting the
> query and reduce system load from ~8 to ~1. Having this patch in
> pg_stat_statements would have been critical to get the full picture of what
> was going on earlier.
>
> Thomas: I'm not as familiar with planner internals as you are, but happy to
> try and contribute here. Would it be useful for me to try to adjust the
> patch to Tom's proposal?

Hi Lukas,

Please feel free! I'm sure this will be a useful feature.
Unfortunately I wasn't able to get back to it in time for PG11. It
did make an attempt though, and got stuck on some confusion about
whether you want the PREPARE or the "real" statement when using
prepared plans; I don't recall the details now.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2018-03-31 01:55:50 Re: [HACKERS] A design for amcheck heapam verification
Previous Message Andres Freund 2018-03-31 01:20:31 Re: [HACKERS] A design for amcheck heapam verification