| From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Simon Riggs <simon(at)2ndquadrant(dot)com>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Where does the time go? |
| Date: | 2006-03-25 15:45:37 |
| Message-ID: | 20060325154537.GD1695@svana.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers pgsql-patches |
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(at)svana(dot)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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Dunstan | 2006-03-25 15:54:26 | Re: [SUGGESTION] CVSync |
| Previous Message | Martijn van Oosterhout | 2006-03-25 15:24:05 | Re: Where does the time go? |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Simon Riggs | 2006-03-25 17:38:26 | Re: Where does the time go? |
| Previous Message | Martijn van Oosterhout | 2006-03-25 15:24:05 | Re: Where does the time go? |