This recipe explains what to do if you think your query should use an index, but it isn't.
There could be several reasons for this, but most often, the reason is that the optimizer believes that, based on the available distribution statistics, it is cheaper and faster to use a query plan that does not use that specific index.
First, check that your index exists, and ensure that the table has been analyzed. If there is any doubt, rerun it to be sure:
postgres=# ANALYZE; ANALYZE
Force index usage and compare plan costs with an index and without, as follows:
postgres=# EXPLAIN ANALYZE SELECT count(*) FROM itable WHERE id > 500; QUERY PLAN --------------------------------------------------------------------- Aggregate (cost=188.75..188.76 rows=1 width=0) (actual time=37.958..37.959 rows=1 loops=1) -> Seq Scan on itable (cost=0.00..165.00 rows=9500 width=0) (actual...