"Mark Cave-Ayland" <[EMAIL PROTECTED]> 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 ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly