Re: Where does the time go?

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Where does the time go?
Дата
Msg-id 20060325154537.GD1695@svana.org
обсуждение исходный текст
Ответ на Re: Where does the time go?  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-hackers
On Sat, Mar 25, 2006 at 04:24:05PM +0100, Martijn van Oosterhout wrote:
> I agree. However, if it's the overhead of calling gettimeofday() that
> slows everything down, perhaps we should tackle that end. For example,
> have a sampling mode that only times say 5% of the executed nodes.
>
> EXPLAIN ANALYZE SAMPLE blah;

<snip>

> You could do a non-random sampling fairly easily:

Actually, I thought of a better way to control the sampling that's
probably better than the crude if-then-else structure I gave which also
takes advantage of the fact that the numbers are floating point:

InstrInit:
next_sample = 0;

InstrStart:   if( ntuples < 16 )       dosample = yes;   else if( ntuples > next_sample )   {       dosample = yes;
 next_sample += log2(ntuples);   }   else       dosample = no; 

This will sample approxiamtly log2 of the actual executions. You could
use log10(), sqrt() or any other function you find reflects the sample
you want.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Andrew Dunstan"
Дата:
Сообщение: Re: [SUGGESTION] CVSync
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [SUGGESTION] CVSync