Manikandan Swaminathan <maniswam...@gmail.com> writes: > 4. When running the following query, I would expect the index "idx_col_b_a" > to be used: select min(col_b) from test_table where col_a > 4996. > I have a range-based filter on col_a, and am aggregating the result with > min(col_b). Both columns are covered by "idx_col_b_a".
They may be covered, but sort order matters, and that index has the wrong sort order to help with this query. Try create index on test_table(col_b, col_a); regards, tom lane