Re: auto_explain sample rate

Поиск
Список
Период
Сортировка
Искать
От
Julien Rouhaud
Тема
Re: auto_explain sample rate
Дата
Msg-id
559BD603.4000901@dalibo.com
Ответ на
Список
Дерево обсуждения
auto_explain sample rate Craig Ringer <craig@2ndquadrant.com>
Re: auto_explain sample rate Tom Lane <tgl@sss.pgh.pa.us>
Re: auto_explain sample rate Craig Ringer <craig@2ndquadrant.com>
Re: auto_explain sample rate Pavel Stehule <pavel.stehule@gmail.com>
Re: auto_explain sample rate Craig Ringer <craig@2ndquadrant.com>
Re: auto_explain sample rate Pavel Stehule <pavel.stehule@gmail.com>
Re: auto_explain sample rate Craig Ringer <craig@2ndquadrant.com>
Re: auto_explain sample rate Pavel Stehule <pavel.stehule@gmail.com>
Re: auto_explain sample rate Craig Ringer <craig@2ndquadrant.com>
Re: auto_explain sample rate Craig Ringer <craig@2ndquadrant.com>
Re: auto_explain sample rate Andres Freund <andres@anarazel.de>
Re: auto_explain sample rate Craig Ringer <craig@2ndquadrant.com>
Re: auto_explain sample rate Julien Rouhaud <julien.rouhaud@dalibo.com>
Re: auto_explain sample rate Julien Rouhaud <julien.rouhaud@dalibo.com>
Re: auto_explain sample rate Craig Ringer <craig@2ndquadrant.com>
Re: auto_explain sample rate Michael Paquier <michael.paquier@gmail.com>
Re: auto_explain sample rate Julien Rouhaud <julien.rouhaud@dalibo.com>
Re: auto_explain sample rate Alvaro Herrera <alvherre@2ndquadrant.com>
Re: auto_explain sample rate Julien Rouhaud <julien.rouhaud@dalibo.com>
Re: auto_explain sample rate Petr Jelinek <petr@2ndquadrant.com>
Re: auto_explain sample rate Julien Rouhaud <julien.rouhaud@dalibo.com>
Re: auto_explain sample rate Petr Jelinek <petr@2ndquadrant.com>
Re: auto_explain sample rate Magnus Hagander <magnus@hagander.net>
Re: auto_explain sample rate Julien Rouhaud <julien.rouhaud@dalibo.com>
Re: auto_explain sample rate Magnus Hagander <magnus@hagander.net>
Re: auto_explain sample rate Magnus Hagander <magnus@hagander.net>
Re: auto_explain sample rate Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: auto_explain sample rate Robert Haas <robertmhaas@gmail.com>
Re: auto_explain sample rate Julien Rouhaud <julien.rouhaud@dalibo.com>
Re: auto_explain sample rate Magnus Hagander <magnus@hagander.net>
Re: auto_explain sample rate Julien Rouhaud <julien.rouhaud@dalibo.com>
Re: auto_explain sample rate Petr Jelinek <petr@2ndquadrant.com>
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 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
> 
> 


-- 
Julien Rouhaud
http://dalibo.com - http://dalibo.org
В списке pgsql-hackers по дате отправления
От: Fujii Masao
Дата:
От: Andres Freund
Дата:
FAQ