On 12/15/20 8:17 AM, Yambu wrote:
Hi

How would you optimize a query with greater than in where clause eg

select * from table1 where id > 1000

and there is an index on id column

The question as written is unanswerable.

- Why do you think it needs to be optimized?
- What is the table cardinality, and the query cardinality?
- What does EXPLAIN say?
- Have you run ANALYZE on table1?

Bottom line: Postgres *might* think that it is more efficient to scan the whole table.

--
Angular momentum makes the world go 'round.

Reply via email to