Unix Technical Forum

[PATCH] Improve EXPLAIN ANALYZE overhead by sampling

This is a discussion on [PATCH] Improve EXPLAIN ANALYZE overhead by sampling within the Pgsql Patches forums, part of the PostgreSQL category; --> On Tue, May 30, 2006 at 10:01:49AM -0400, Bruce Momjian wrote: > > Patch applied. Thanks. I note Tom ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 04-18-2008, 01:41 AM
Martijn van Oosterhout
 
Posts: n/a
Default Re: [PATCH] Improve EXPLAIN ANALYZE overhead by sampling

On Tue, May 30, 2006 at 10:01:49AM -0400, Bruce Momjian wrote:
>
> Patch applied. Thanks.


I note Tom made some changes to this patch after it went in. For the
record, it was always my intention that samplecount count the number of
_tuples_ returned while sampling, rather than the number of
_iterations_. I'll admit the comment in the header was wrong.

While my original patch had a small error in the case of multiple
tuples returned, it would've been correctable by counting the actual
number of sample. The way it is now, it will show a bias if the number
of tuples returned increases after the first sampled 50 tuples.
However, my knowledge of statistics isn't good enough to determine if
this is an actual problem or not, since the way it is now will sample
more initialially...

Have a nice 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.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFEfo1qIB7bNG8LQkwRAhXSAJ96DJkclLH8oxkwYhz2SB 4EFyDLLgCeK7uo
+J/kSeElojU0pxUdNWx1I6I=
=36+6
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 04-18-2008, 01:41 AM
Tom Lane
 
Posts: n/a
Default Re: [PATCH] Improve EXPLAIN ANALYZE overhead by sampling

Martijn van Oosterhout <kleptog@svana.org> writes:
> I note Tom made some changes to this patch after it went in. For the
> record, it was always my intention that samplecount count the number of
> _tuples_ returned while sampling, rather than the number of
> _iterations_. I'll admit the comment in the header was wrong.


> While my original patch had a small error in the case of multiple
> tuples returned, it would've been correctable by counting the actual
> number of sample. The way it is now, it will show a bias if the number
> of tuples returned increases after the first sampled 50 tuples.


How so? The number of tuples doesn't enter into it at all. What the
code is now assuming is that the time per node iteration is constant.
More importantly, it's subtracting off an overhead estimate that's
measured per iteration. In the math you had before, the overhead was
effectively assumed to be per tuple, which is clearly wrong.

For nodes that return a variable number of tuples, it might be sensible
to presume that the node iteration time is roughly linear in the number
of tuples returned, but I find that debatable. In any case the sampling
overhead is certainly not dependent on how many tuples an iteration
returns.

This is all really moot at the moment, since we have only two kinds of
nodes: those that always return 1 tuple (until done) and those that
return all their tuples in a single iteration. If we ever get into
nodes that return varying numbers of tuples per iteration --- say,
exposing btree's page-at-a-time behavior at the plan node level ---
we'd have to rethink this. But AFAICS we'd need to count both tuples
and iterations to have a model that made any sense at all, so the
extra counter I added is needed anyway.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:44 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com