← Backend PythonQuestion 31 of 49
Why might an index not be used when most rows match the condition?
📘 Explanation
When most rows match a condition, the index has low selectivity, so a full table scan avoiding random I/O can be cheaper than traversing the index. The other reasons—sorting preference, uniqueness requirements, or aggregate functions disabling indexes—do not reflect how query planners actually work.
Related questions
- What is the left-prefix rule for composite indexes?
- What are partial indexes and functional indexes, and what problems do they solve?
- What is the difference between ANALYZE and VACUUM ANALYZE in PostgreSQL?
- Why might a query using LOWER(email) not use an index on email?
- What is the difference between EXPLAIN and EXPLAIN ANALYZE in PostgreSQL?
← PreviousNo login needed