Re: join selectivity
| От | Tom Lane |
|---|---|
| Тема | Re: join selectivity |
| Дата | |
| Msg-id | 24929.1103212470@sss.pgh.pa.us обсуждение |
| Ответ на | Re: join selectivity ("Mark Cave-Ayland" <m.cave-ayland@webbased.co.uk>) |
| Ответы |
Re: join selectivity
|
| Список | pgsql-hackers |
"Mark Cave-Ayland" <m.cave-ayland@webbased.co.uk> writes:
> ...and with two indices RESTRICT is called four times. The part I find
> confusing is why with one index that RESTRICT is called twice.
[ shrug... ] clause_selectivity doesn't try to cache the result.
> I was also thinking whether calling RESTRICT when comparing with an unknown
> value is worth doing at all, however I did think that perhaps if you are
> using a cast to perform an operation on two datatypes, then you may be able
> to imply something from the index, such as its physical size, and hint that
> the planner should use a particular index in preference for the other.
That would be inappropriate; the index size is factored in elsewhere
(gistcostestimate() to be specific). Restriction selectivity shouldn't
directly consider the existence of indexes at all.
> Would it be correct to assume that if returning the same value for
> RESTRICT for both means that the planner will choose one at random?
If the tables/indexes are exactly the same size then you'd get the same
cost and the choice would be effectively random.
regards, tom lane
В списке pgsql-hackers по дате отправления: