Perhaps PG is different but for the DB we use the ordering usually wins out over raw selectivity. Meaning it'll prefer an multi-column index that matches the ORDER BY even if it has a fair bit less selectivity.
Due to this we sometimes have to add multiple indexes with different permutations of the same columns.
Comments
Perhaps PG is different but for the DB we use the ordering usually wins out over raw selectivity. Meaning it'll prefer an multi-column index that matches the ORDER BY even if it has a fair bit less selectivity.
Due to this we sometimes have to add multiple indexes with different permutations of the same columns.