I'm currently using PostgreSQL 14.0 for windows My target table has a 900k+ rows and my query is using single column filter (status_id). The column status_id is indexed via btree (default) When i execute 'explain analyze select * from trip_detail where status_id = 5', the query planner use sequential scan
Seq Scan on trip_detail (cost=0.00..69261.82 rows=912875 width=511) (actual time=1.404..457.886 rows=913420 loops=1)
Filter: (status_id = 5)
Rows Removed by Filter: 19320
Planning Time: 0.216 ms
Execution Time: 493.398 ms
If i use a different value, it uses the Index scan
Index Scan using idx_tttdc_status_idh5 on trip_detail (cost=0.42..131.10 rows=1400 width=511) (actual time=106.692..138.531 rows=1515 loops=1)
Index Cond: (status_id = 12)
Planning Time: 0.236 ms
Execution Time: 138.764 ms
I already vacuumed, reindexed and analyzed the table and indexes, but it still uses a sequential scan for the large row groups. What might cause for this kind of issue?