"George Pavlov" <gpavlov@mynewplace.com> writes:
> I am curious what could make the PA query to ignore the index. What are
> the specific stats that are being used to make this decision?
The frequency of the specific value being searched for, and the overall
order-correlation of the column. Since the latter is not dependent on a
particular value, my guess at the reason for the inconsistent results is
that you don't have the column's statistics target set high enough to
track all the interesting values --- or maybe just not high enough to
acquire sufficiently accurate frequency estimates for them. Take a look
at the pg_stats row for the column ...
(The default statistics target is 10, which is widely considered too
low --- you might find 100 more suitable.)
regards, tom lane