Martijn van Oosterhout <kleptog@svana.org> writes:
> That's very strange.
Not really. In the dummy example, the two indexes are exactly the same
size and so there is no reason for the planner to prefer one over the
other. (Note that the two plans have exactly the same estimated cost.)
In a real example, with appropriate statistics from VACUUM or ANALYZE,
the planner would tend to prefer the smaller index.
If we had code to suppress the extra evaluation of the partial-index
condition (which we do not) then possibly the planner would be able
to favor the partial index on the grounds of less computation per row.
I don't see any simple way to suppress those clauses early enough to
let that cost difference figure into planning, though.
regards, tom lane