Re: [HACKERS] auto_explain sample rate

2016-03-13 Thread Magnus Hagander
On Sat, Mar 12, 2016 at 3:20 PM, Julien Rouhaud wrote: > On 11/03/2016 17:55, Robert Haas wrote: > > On Fri, Mar 11, 2016 at 11:33 AM, Tomas Vondra > > wrote: > >> A bit late, but I think we should rename the GUC variable to > >> "sampling_rate" (instead of sample_ratio) as that's what pgbench u

Re: [HACKERS] auto_explain sample rate

2016-03-12 Thread Julien Rouhaud
On 11/03/2016 17:55, Robert Haas wrote: > On Fri, Mar 11, 2016 at 11:33 AM, Tomas Vondra > wrote: >> A bit late, but I think we should rename the GUC variable to >> "sampling_rate" (instead of sample_ratio) as that's what pgbench uses >> for the same thing. That'd be more consistent. > > I like t

Re: [HACKERS] auto_explain sample rate

2016-03-11 Thread Robert Haas
On Fri, Mar 11, 2016 at 11:33 AM, Tomas Vondra wrote: > A bit late, but I think we should rename the GUC variable to > "sampling_rate" (instead of sample_ratio) as that's what pgbench uses > for the same thing. That'd be more consistent. I like that idea. It seems like slightly better terminolog

Re: [HACKERS] auto_explain sample rate

2016-03-11 Thread Tomas Vondra
Hi, On Fri, 2016-03-11 at 15:11 +0100, Magnus Hagander wrote: >  > > > Applied with a minor word-fix in the documentation and removal of > some unrelated whitespace changes.  A bit late, but I think we should rename the GUC variable to "sampling_rate" (instead of sample_ratio) as that's what pgb

Re: [HACKERS] auto_explain sample rate

2016-03-11 Thread Julien Rouhaud
On 11/03/2016 15:11, Magnus Hagander wrote: > > > On Fri, Mar 11, 2016 at 3:03 PM, Magnus Hagander > wrote: > > > > On Fri, Mar 11, 2016 at 2:51 PM, Julien Rouhaud > mailto:julien.rouh...@dalibo.com>> wrote: > > On 11/03/2016 11:45, Magnus Hagander

Re: [HACKERS] auto_explain sample rate

2016-03-11 Thread Magnus Hagander
On Fri, Mar 11, 2016 at 3:03 PM, Magnus Hagander wrote: > > > On Fri, Mar 11, 2016 at 2:51 PM, Julien Rouhaud > wrote: > >> On 11/03/2016 11:45, Magnus Hagander wrote: >> > >> > Coming back to the previous discussions about random() - AFAICT this >> > patch will introduce the random() call alway

Re: [HACKERS] auto_explain sample rate

2016-03-11 Thread Petr Jelinek
On 11/03/16 11:45, Magnus Hagander wrote: On Thu, Mar 10, 2016 at 10:07 PM, Petr Jelinek mailto:p...@2ndquadrant.com>> wrote: On 10/03/16 20:59, Julien Rouhaud wrote: On 10/03/2016 04:37, Petr Jelinek wrote: On 17/02/16 01:17, Julien Rouhaud wrote: Agr

Re: [HACKERS] auto_explain sample rate

2016-03-11 Thread Magnus Hagander
On Fri, Mar 11, 2016 at 2:51 PM, Julien Rouhaud wrote: > On 11/03/2016 11:45, Magnus Hagander wrote: > > > > Coming back to the previous discussions about random() - AFAICT this > > patch will introduce the random() call always (in explain_ExecutorStart): > > > > +if (auto_explain_log_min_duratio

Re: [HACKERS] auto_explain sample rate

2016-03-11 Thread Julien Rouhaud
On 11/03/2016 11:45, Magnus Hagander wrote: > > Coming back to the previous discussions about random() - AFAICT this > patch will introduce the random() call always (in explain_ExecutorStart): > > +if (auto_explain_log_min_duration >= 0 && nesting_level == 0) > +current_query_sampled = (random()

Re: [HACKERS] auto_explain sample rate

2016-03-11 Thread Magnus Hagander
On Thu, Mar 10, 2016 at 10:07 PM, Petr Jelinek wrote: > On 10/03/16 20:59, Julien Rouhaud wrote: > >> On 10/03/2016 04:37, Petr Jelinek wrote: >> >>> On 17/02/16 01:17, Julien Rouhaud wrote: >>> Agreed, it's too obscure. Attached v4 fixes as you said. >>> Seems to be simple en

Re: [HACKERS] auto_explain sample rate

2016-03-10 Thread Petr Jelinek
On 10/03/16 20:59, Julien Rouhaud wrote: On 10/03/2016 04:37, Petr Jelinek wrote: On 17/02/16 01:17, Julien Rouhaud wrote: Agreed, it's too obscure. Attached v4 fixes as you said. Seems to be simple enough patch and works. However I would like documentation to say that the range is 0 to 1 a

Re: [HACKERS] auto_explain sample rate

2016-03-10 Thread Julien Rouhaud
On 10/03/2016 04:37, Petr Jelinek wrote: > On 17/02/16 01:17, Julien Rouhaud wrote: >> >> Agreed, it's too obscure. Attached v4 fixes as you said. >> > > Seems to be simple enough patch and works. However I would like > documentation to say that the range is 0 to 1 and represents fraction of > the

Re: [HACKERS] auto_explain sample rate

2016-03-09 Thread Petr Jelinek
On 17/02/16 01:17, Julien Rouhaud wrote: Agreed, it's too obscure. Attached v4 fixes as you said. Seems to be simple enough patch and works. However I would like documentation to say that the range is 0 to 1 and represents fraction of the queries sampled, because right now both the GUC desc

Re: [HACKERS] auto_explain sample rate

2016-02-16 Thread Julien Rouhaud
On 16/02/2016 22:51, Alvaro Herrera wrote: > Julien Rouhaud wrote: > > Hijacking this macro is just too obscure: > >> #define auto_explain_enabled() \ >> (auto_explain_log_min_duration >= 0 && \ >> - (nesting_level == 0 || auto_explain_log_nested_statements)) >> + (nesting_level ==

Re: [HACKERS] auto_explain sample rate

2016-02-16 Thread Alvaro Herrera
Julien Rouhaud wrote: Hijacking this macro is just too obscure: > #define auto_explain_enabled() \ > (auto_explain_log_min_duration >= 0 && \ > - (nesting_level == 0 || auto_explain_log_nested_statements)) > + (nesting_level == 0 || auto_explain_log_nested_statements) && \ > +

Re: [HACKERS] auto_explain sample rate

2016-02-16 Thread Julien Rouhaud
On 25/08/2015 14:45, Michael Paquier wrote: > On Fri, Jul 17, 2015 at 2:53 PM, Craig Ringer wrote: >> On 7 July 2015 at 21:37, Julien Rouhaud wrote: >> >>> Well, I obviously missed that pg_srand48() is only used if the system >>> lacks random/srandom, sorry for the noise. So yes, random() must b

Re: [HACKERS] auto_explain sample rate

2015-08-25 Thread Michael Paquier
On Fri, Jul 17, 2015 at 2:53 PM, Craig Ringer wrote: > On 7 July 2015 at 21:37, Julien Rouhaud wrote: > >> Well, I obviously missed that pg_srand48() is only used if the system >> lacks random/srandom, sorry for the noise. So yes, random() must be >> used instead of pg_lrand48(). >> >> I'm attac

Re: [HACKERS] auto_explain sample rate

2015-07-16 Thread Craig Ringer
On 7 July 2015 at 21:37, Julien Rouhaud wrote: > Well, I obviously missed that pg_srand48() is only used if the system > lacks random/srandom, sorry for the noise. So yes, random() must be > used instead of pg_lrand48(). > > I'm attaching a new version of the patch fixing this issue just in case

Re: [HACKERS] auto_explain sample rate

2015-07-07 Thread Julien Rouhaud
On 05/07/2015 18:22, Julien Rouhaud wrote: > On 03/06/2015 15:00, Craig Ringer wrote: >> >> >> On 3 June 2015 at 20:04, Andres Freund > > wrote: >> >> On 2015-06-03 18:54:24 +0800, Craig Ringer wrote: >> > OK, here we go. >> >> Hm. Wouldn't random sampling be

Re: [HACKERS] auto_explain sample rate

2015-07-05 Thread Julien Rouhaud
On 03/06/2015 15:00, Craig Ringer wrote: > > > On 3 June 2015 at 20:04, Andres Freund > wrote: > > On 2015-06-03 18:54:24 +0800, Craig Ringer wrote: > > OK, here we go. > > Hm. Wouldn't random sampling be better than what you do? If your queries > hav

Re: [HACKERS] auto_explain sample rate

2015-06-03 Thread Craig Ringer
On 3 June 2015 at 20:04, Andres Freund wrote: > On 2015-06-03 18:54:24 +0800, Craig Ringer wrote: > > OK, here we go. > > Hm. Wouldn't random sampling be better than what you do? If your queries > have a pattern to them (e.g. you always issue the same 10 queries in > succession), this will possib

Re: [HACKERS] auto_explain sample rate

2015-06-03 Thread Andres Freund
On 2015-06-03 18:54:24 +0800, Craig Ringer wrote: > OK, here we go. Hm. Wouldn't random sampling be better than what you do? If your queries have a pattern to them (e.g. you always issue the same 10 queries in succession), this will possibly only show a subset of the queries. I think a formulatio

Re: [HACKERS] auto_explain sample rate

2015-06-03 Thread Craig Ringer
On 2 June 2015 at 15:07, Craig Ringer wrote: > On 29 May 2015 at 11:35, Tom Lane wrote: > >> Craig Ringer writes: >> > It's sometimes desirable to collect auto_explain data with ANALYZE in >> order >> > to track down hard-to-reproduce issues, but the performance impacts can >> be >> > pretty he

Re: [HACKERS] auto_explain sample rate

2015-06-03 Thread Craig Ringer
> > >> lot of variants - I would to see cost and times for EXPLAIN ANALYZE every > time - but the precision of time can be reduced to 1ms. It is question if > we can significantly reduce the cost (or number of calls) of getting system > time. > > Pavel > > > OK, so you're suggesting a sampling-base

Re: [HACKERS] auto_explain sample rate

2015-06-03 Thread Pavel Stehule
2015-06-03 9:46 GMT+02:00 Craig Ringer : > > On 3 June 2015 at 15:22, Pavel Stehule wrote: > >> >> >> 2015-06-03 9:17 GMT+02:00 Craig Ringer : >> >>> >>> >>> On 2 June 2015 at 15:11, Pavel Stehule wrote: >>> 2015-06-02 9:07 GMT+02:00 Craig Ringer : > > For the majorit

Re: [HACKERS] auto_explain sample rate

2015-06-03 Thread Craig Ringer
On 3 June 2015 at 15:22, Pavel Stehule wrote: > > > 2015-06-03 9:17 GMT+02:00 Craig Ringer : > >> >> >> On 2 June 2015 at 15:11, Pavel Stehule wrote: >> >>> >>> >>> 2015-06-02 9:07 GMT+02:00 Craig Ringer : >>> For the majority of users I'm sure it's sufficient to just have a sampl

Re: [HACKERS] auto_explain sample rate

2015-06-03 Thread Pavel Stehule
2015-06-03 9:17 GMT+02:00 Craig Ringer : > > > On 2 June 2015 at 15:11, Pavel Stehule wrote: > >> >> >> 2015-06-02 9:07 GMT+02:00 Craig Ringer : >> >>> >>> For the majority of users I'm sure it's sufficient to just have a sample >>> rate. >>> >>> Anything that's trying to match individual queries

Re: [HACKERS] auto_explain sample rate

2015-06-03 Thread Craig Ringer
On 2 June 2015 at 15:11, Pavel Stehule wrote: > > > 2015-06-02 9:07 GMT+02:00 Craig Ringer : > >> >> For the majority of users I'm sure it's sufficient to just have a sample >> rate. >> >> Anything that's trying to match individual queries could be interested in >> all sorts of different things.

Re: [HACKERS] auto_explain sample rate

2015-06-02 Thread Pavel Stehule
2015-06-02 9:07 GMT+02:00 Craig Ringer : > On 29 May 2015 at 11:35, Tom Lane wrote: > >> Craig Ringer writes: >> > It's sometimes desirable to collect auto_explain data with ANALYZE in >> order >> > to track down hard-to-reproduce issues, but the performance impacts can >> be >> > pretty hefty o

Re: [HACKERS] auto_explain sample rate

2015-06-02 Thread Craig Ringer
On 29 May 2015 at 11:35, Tom Lane wrote: > Craig Ringer writes: > > It's sometimes desirable to collect auto_explain data with ANALYZE in > order > > to track down hard-to-reproduce issues, but the performance impacts can > be > > pretty hefty on the DB. > > > I'm inclined to add a sample rate t

Re: [HACKERS] auto_explain sample rate

2015-05-28 Thread Tom Lane
Craig Ringer writes: > It's sometimes desirable to collect auto_explain data with ANALYZE in order > to track down hard-to-reproduce issues, but the performance impacts can be > pretty hefty on the DB. > I'm inclined to add a sample rate to auto_explain so that it can trigger > only on x percent