Re: Updating histogram_bounds after a delete
От | Tom Lane |
---|---|
Тема | Re: Updating histogram_bounds after a delete |
Дата | |
Msg-id | 12606.1300374059@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Updating histogram_bounds after a delete ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>) |
Список | pgsql-performance |
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes: > Derrick Rice <derrick.rice@gmail.com> wrote: >> Kevin Grittner <Kevin.Grittner@wicourts.gov wrote: >>> there is a feature to probe the end of an index's range in >>> situations where data skew was often causing less than optimal >>> plans to be chosen. >> Was this introduced in 9.0 or was it earlier? > I don't remember when it was added. I took a stab at searching for > it, but didn't get it figured out; if nobody who knows off-hand > jumps in, I'll try again when I have more time. Author: Tom Lane <tgl@sss.pgh.pa.us> Branch: master Release: REL9_0_BR [40608e7f9] 2010-01-04 02:44:40 +0000 When estimating the selectivity of an inequality "column > constant" or "column < constant", and the comparison value is in the first or last histogram bin or outside the histogram entirely, try to fetch the actual column min or max value using an index scan (if there is an index on the column). If successful, replace the lower or upper histogram bound with that value before carrying on with the estimate. This limits the estimation error caused by moving min/max values when the comparison value is close to the min or max. Per a complaint from Josh Berkus. It is tempting to consider using this mechanism for mergejoinscansel as well, but that would inject index fetches into main-line join estimation not just endpoint cases. I'm refraining from that until we can get a better handle on the costs of doing this type of lookup. regards, tom lane
В списке pgsql-performance по дате отправления: