PostgreSQL manualy change query execution plan to force using sort and sequential access instead of full scan
问题 I have simple query like this: SELECT * FROM t1 WHERE f1 > 42 AND f2 = 'foo' AND f3 = 'bar' ORDER BY f4 DESC LIMIT 10 OFFSET 100; I have index for field f4 (for other queries). Condition "f1 > 42 AND f2 = 'foo' AND f3 = 'bar'" is not representative and corresponds to 70% of records in table t1. It's about 2 000 000 records in table and it is growing up every day. Query plan explanation for this query shows using of seq scan by entire table and then performing ordering and limitation. Is it