Unix Technical Forum

Are cost estimates based on asserts?

This is a discussion on Are cost estimates based on asserts? within the pgsql Hackers forums, part of the PostgreSQL category; --> I'm running right now with a dev build which was configured with --enable-cassert (and --enable-debug). Just out of curiosity, ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 06:12 AM
Kevin Grittner
 
Posts: n/a
Default Are cost estimates based on asserts?

I'm running right now with a dev build which was configured with
--enable-cassert (and --enable-debug). Just out of curiosity, I re-ran
the query which chose the sort and mergejoin over the (faster) nested
index scan. The results seem interesting, although I'd need more tests
to consider them entirely reliable. I've divided the actual run time
(in ms) by the cost estimate, to come up with the ratio of ms per unit
of estimated cost. I'll round to three significant digits, based on
observed variation from one test to another.

==============================
WITH --enable-cassert
==============================

uncached sort/merge: 0.194
uncached nested scan: 0.288

cached sort/merge: 0.0340
cached nested scan: 0.0560

==============================
WITHOUT --enable-cassert
==============================

uncached sort/merge: 0.182
uncached nested scan: 0.0478

cached sort/merge: 0.0256
cached nested scan: 0.00494

This shows me that when assertions are being tested, the cost estimates
are slightly skewed to favor nested scans. When assertions are not
tested, costs seem to be significantly distorted in favor of the
sort/merge. The assertion load on the index scan seems to be extreme.
It'll take some time to make sure that I can reproduce this, but I
wanted to put this out there for comment and possible independent
confirmation.

-Kevin


---------------------------(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
  #2 (permalink)  
Old 04-11-2008, 06:12 AM
Tom Lane
 
Posts: n/a
Default Re: Are cost estimates based on asserts?

"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> [$subject]


No, the planner has no idea about the cost of Asserts.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

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 10:01 PM.


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