Re: auto_explain sample rate

Поиск
Список
Период
Сортировка
От Julien Rouhaud
Тема Re: auto_explain sample rate
Дата
Msg-id 559959C9.8010009@dalibo.com
обсуждение исходный текст
Ответ на Re: auto_explain sample rate  (Craig Ringer <craig@2ndquadrant.com>)
Ответы Re: auto_explain sample rate  (Julien Rouhaud <julien.rouhaud@dalibo.com>)
Список pgsql-hackers
On 03/06/2015 15:00, Craig Ringer wrote:
> 
> 
> On 3 June 2015 at 20:04, Andres Freund <andres@anarazel.de
> <mailto:andres@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 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?

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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [patch] typo in brin.sql
Следующее
От: Petr Korobeinikov
Дата:
Сообщение: Re: Comfortably check BackendPID with psql