Skip site navigation (1) Skip section navigation (2)

Re: Multi-pass planner

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Robert Haas" <robertmhaas(at)gmail(dot)com>, "Greg Stark" <gsstark(at)mit(dot)edu>
Cc: "decibel" <decibel(at)decibel(dot)org>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multi-pass planner
Date: 2009-08-20 18:16:53
Message-ID: 4A8D4CC50200002500029EBD@gw.wicourts.gov (view raw or flat)
Thread:
Lists: pgsql-hackers
Greg Stark <gsstark(at)mit(dot)edu> wrote:
 
> Say you're deciding between an index scan and a sequential scan. The
> sequential scan has a total cost of 1000..1000 but the index scan
> has an estimated total cost of 1..10000.
 
My proposal was to use RMS, which would effectively favor lower worst
case behavior.  Specifically, if the estimated cost range is
1000..1000 you get sqrt((1000*1000+1000*1000)/2) = 1000, while
1..10000 yields sqrt((1*1+10000*10000)/2) = 7071.067847.  So with this
heuristic it would prefer the sequential scan.
 
Of course, for these purposes, you would get the same choices by
leaving off the division and square root calculation, so it could
simplify to choosing the lower of 1000*1000+1000*1000 versus
1*1+10000*10000.
 
-Kevin

In response to

pgsql-hackers by date

Next:From: Robert HaasDate: 2009-08-20 18:48:52
Subject: converting between netmask formats
Previous:From: Greg StarkDate: 2009-08-20 17:31:56
Subject: Re: Multi-pass planner

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group