Pallav Kalva <pkalva@xxxxxxxxxxxxxxxxx> writes: > why does it have different plans for different values Because the values occur different numbers of times (or so it thinks anyway). If the rowcount estimates are far from reality, perhaps increasing the statistics target would help. However, since you only showed EXPLAIN and not EXPLAIN ANALYZE output, no one can really tell whether the optimizer did anything wrong here. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend