|From:||Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>|
|To:||Craig Ringer <craig(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>|
|Cc:||Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>|
|Subject:||Re: auto_explain sample rate|
|Views:||Raw Message | Whole Thread | Download mbox|
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 <andres(at)anarazel(dot)de
>> <mailto:andres(at)anarazel(dot)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 will possibly only show a subset of the queries.
>> I think a formulation in fraction (i.e. a float between 0 and 1) will
>> also be easier to understand.
>> Could be, yeah. I was thinking about the cost of generating a random
>> each time, but it's going to vanish in the noise compared to the rest of
>> the costs in query execution.
> Hello, I've just reviewed the patch.
> I'm not sure if there's a consensus on the sample rate format. FWIW, I
> also think a fraction would be easier to understand. Any news about
> generating a random at each call to avoid the query pattern problem ?
> The patch applies without error. I wonder if there's any reason for
> using pg_lrand48() instead of random(), as there's a port for random()
> if the system lacks it.
> After some quick checks, I found that auto_explain_sample_counter is
> always initialized with the same value. After some digging, it seems
> that pg_lrand48() always returns the same values in the same order, at
> least on my computer. Have I missed something?
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.
> Otherwise, after replacing the pg_lrand48() call with a random(), it
> works just fine.
>> Craig Ringer http://www.2ndQuadrant.com/
>> PostgreSQL Development, 24x7 Support, Training & Services
|Next Message||Andres Freund||2015-07-07 13:41:30||Re: creating extension including dependencies|
|Previous Message||Fujii Masao||2015-07-07 13:36:29||Re: creating extension including dependencies|