Shayon Mukherjee does some performance tuning:
Recently I have been working with some queries in Postgres where I noticed either it has decided not to use an index and perform a sequential scan, or it decided to use an alternative index over a composite partial index. This was quite puzzling, especially when you know there are indexes in the system that can perform these queries faster.
So what gives?
After some research, I stumbled upon
random_page_cost
(ref).
Read on to learn more about what this is, how you can change it, and a warning before you go wild in changing it.