该表数据3w左右,执行非索引查询耗时很长,今天开始,该表非索引查询非常慢。
异常explain:
EXPLAIN (analyze,buffers,verbose) select count(*) from user_order where status>6;
Aggregate (cost=2084738.25..2084738.26 rows=1 width=8) (actual time=72474.226..72474.227 rows=1 loops=1)
Output: count(*)
Buffers: shared hit=1369866 read=714388
-> Seq Scan on public.user_order (cost=0.00..2084671.73 rows=26609 width=0) (actual time=1678.079..72471.900 rows=33169 loops=1)
Filter: (user_order.status > 6)
Rows Removed by Filter: 6268
Buffers: shared hit=1369866 read=714388
Planning time: 0.069 ms
Execution time: 72474.265 ms
正常explain
EXPLAIN (analyze,buffers,verbose) select count(*) from user_order where status>6;
Aggregate (cost=6113.74..6113.76 rows=1 width=8) (actual time=36.143..36.143 rows=1 loops=1)
Output: count(*)
Buffers: shared hit=5362
-> Seq Scan on public.user_order (cost=0.00..5999.59 rows=45663 width=0) (actual time=0.017..32.729 rows=46022 loops=1)
Filter: (user_order.status > 6)
Rows Removed by Filter: 5219
Buffers: shared hit=5362
Planning time: 0.393 ms
Execution time: 36.260 ms