From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Fuzzy cost comparison to eliminate redundant planning |
Date: | 2004-03-29 06:20:56 |
Message-ID: | 200403290620.i2T6KuI19245@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Do we know in the optimizer whether we will be needing cheapest startup
> > or not?
>
> No. Higher levels might want either.
>
> > Is the middle one kept because the optimizer has to mix the startup plus
> > some percentage of the total cost for queries using LIMIT?
>
> Right. There are potentially some ranges of LIMIT for which it could
> win, I believe. Maybe with some math you could prove there is no range
> in which the other two don't dominate it, but I suspect the extra logic
> would slow down add_path more than it's worth.
What if we take the total cost and divide it by the number of rows returned ---
then we have a per-row cost for each plan. Then we subtract the two, and
that difference compared to the difference in startup costs tell us how
many rows could potentially use this plan.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-03-29 06:54:52 | Re: Fuzzy cost comparison to eliminate redundant planning |
Previous Message | Tom Lane | 2004-03-29 06:05:54 | Re: Fuzzy cost comparison to eliminate redundant planning work |