Why does PostgreSQL perform sequential scan on indexed column?
Very simple example - one table, one index, one query: CREATE TABLE book ( id bigserial NOT NULL, "year" integer, -- other columns... ); CREATE INDEX book_year_idx ON book (year) EXPLAIN SELECT * FROM book b WHERE b.year > 2009 gives me: Seq Scan on book b (cost=0.00..25663.80 rows=105425 width=622) Filter: (year > 2009) Why it does NOT perform index scan instead? What am I missing? If the SELECT returns more than approximately 5-10% of all rows in the table, a sequential scan is much faster than an index scan. This is because an index scan requires several IO operations for each row (look up