Re: Risk Estimation WAS: Planner hints in Postgresql - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Risk Estimation WAS: Planner hints in Postgresql
Date
Msg-id 3610.1395326728@sss.pgh.pa.us
Whole thread Raw
In response to Re: Risk Estimation WAS: Planner hints in Postgresql  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Risk Estimation WAS: Planner hints in Postgresql  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> So you might think that the problem here is that we're assuming
> uniform density.  Let's say there are a million rows in the table, and
> there are 100 that match our criteria, so the first one is going to
> happen 1/10,000'th of the way through the table.  Thus we set SC =
> 0.0001 * TC, and that turns out to be an underestimate if the
> distribution isn't as favorable as we're hoping.  However, that is NOT
> what we are doing.  What we are doing is setting SC = 0.  I mean, not
> quite 0, but yeah, effectively 0. Essentially we're assuming that no
> matter how selective the filter condition may be, we assume that it
> will match *the very first row*.

I think this is wrong.  Yeah, the SC may be 0 or near it, but the time to
fetch the first tuple is estimated as SC + (TC-SC)/N.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Risk Estimation WAS: Planner hints in Postgresql
Next
From: Tom Lane
Date:
Subject: Re: Review: plpgsql.extra_warnings, plpgsql.extra_errors