Jeffrey Tenny <jeffrey.tenny@xxxxxxxxxxx> writes: > I tried the seqscan disabling and got what sounds like the desired plan: > Sort (cost=54900.62..54940.29 rows=1587 width=16) (actual time=20.208..22.138 rows=677 loops=1) > Sort Key: f, c > -> Index Scan using x_f_idx, x_f_idx, ... > (cost=0.00..54056.96 rows=1587 width=16) (actual time=1.048..15.598 rows=677 loops=1) > Index Cond: ((f = 1) OR (f = 2) OR (f = 3) .... Hm, vs 35000 or so estimates for the slower plans. My recommendation would be to decrease random_page_cost to 2 or so, instead of the brute force disable-seqscans approach. regards, tom lane