Re: [PATCH] Improve EXPLAIN ANALYZE overhead by sampling - Mailing list pgsql-patches

From Martijn van Oosterhout
Subject Re: [PATCH] Improve EXPLAIN ANALYZE overhead by sampling
Date
Msg-id 20060513193509.GL12955@svana.org
Whole thread Raw
In response to Re: [PATCH] Improve EXPLAIN ANALYZE overhead by sampling  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
List pgsql-patches
[Sorry for the delay, I'm not subscribed to I didn't see your message
till I checked the archive. Please CC for a quicker response.]

> I got two questions after scanning the patch:
>
> (1) For a node with 50 loops and another one 50+10^3 loops, the first
> one will be measured 50 times and the second one will be measured 50+10
> times? I am not sure if this is rational.

You're miscalculating. For N tuples it samples approximatly 1.5*N^(2/3)
so that would be a bit less than 50+150 samples (my little script
suggests 197 samples).

$ perl -MMath::Complex -e '
for $i (1..1050) {
   if( $i < 50 ) { $s++ }
   else {
    if( $i > $t ) { $s++; $t += cbrt($i); }
   }
}; print "$s\n"; '
197

> (2) Will this patch instruct multinode without interval? This is
> because we always use ntuples=0 for multinode, so the tuplecount will
> not change.

Well, if the tuple count always stays under 50 then it will always
sample. At the time it decides whether to sample or not (the beginning
of the node) it obviously has no idea what will be returned.

Have a ncie day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Question on win32 semaphore simulation
Next
From: Martijn van Oosterhout
Date:
Subject: [PATCH] Warning about configure args (weaker version)