Re: [PATCH] Improve EXPLAIN ANALYZE overhead by sampling

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] Improve EXPLAIN ANALYZE overhead by sampling
Date: 2006-05-13 19:35:09
Message-ID: 20060513193509.GL12955@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-05-13 19:38:08 pg_dump and backslash escapes
Previous Message Bruce Momjian 2006-05-13 16:21:06 Mention pg_dump version portability

Browse pgsql-patches by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-05-14 21:03:03 [PATCH] Warning about configure args (weaker version)
Previous Message Martijn van Oosterhout 2006-05-13 08:55:26 Re: [GENERAL] Querying libpq compile time options