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 > >>

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

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

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

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 > >

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

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 > 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

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

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.

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

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 >

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

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

Re: [HACKERS] auto_explain sample rate

2015-08-25 Thread Michael Paquier
On Fri, Jul 17, 2015 at 2:53 PM, Craig Ringer cr...@2ndquadrant.com wrote: On 7 July 2015 at 21:37, Julien Rouhaud julien.rouh...@dalibo.com 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

Re: [HACKERS] auto_explain sample rate

2015-07-16 Thread Craig Ringer
On 7 July 2015 at 21:37, Julien Rouhaud julien.rouh...@dalibo.com 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

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 and...@anarazel.de mailto:and...@anarazel.de 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 and...@anarazel.de mailto:and...@anarazel.de 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

Re: [HACKERS] auto_explain sample rate

2015-06-03 Thread Craig Ringer
On 3 June 2015 at 20:04, Andres Freund and...@anarazel.de 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

Re: [HACKERS] auto_explain sample rate

2015-06-02 Thread Craig Ringer
On 29 May 2015 at 11:35, Tom Lane t...@sss.pgh.pa.us wrote: Craig Ringer cr...@2ndquadrant.com 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

Re: [HACKERS] auto_explain sample rate

2015-06-02 Thread Pavel Stehule
2015-06-02 9:07 GMT+02:00 Craig Ringer cr...@2ndquadrant.com: On 29 May 2015 at 11:35, Tom Lane t...@sss.pgh.pa.us wrote: Craig Ringer cr...@2ndquadrant.com writes: It's sometimes desirable to collect auto_explain data with ANALYZE in order to track down hard-to-reproduce issues, but the

Re: [HACKERS] auto_explain sample rate

2015-05-28 Thread Tom Lane
Craig Ringer cr...@2ndquadrant.com 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