xiaoming=# explain select * from t1 where a <= 10000; QUERY PLAN--- Index Scan using idx_a_t1 on t1 (cost=0.43..32243.95 rows=20557 width=12) Index Cond: (a <= 10000)(2 rows)索引扫描分为两个阶段:扫描索引数据, 根据索引数据扫描heap表数据,所以它的cost也可以分为两个阶...
->Bitmap Index Scanondemoidx(cost=0.00..5830.24rows=213042width=0) Index Cond:(num<'210'::numeric) (4rows) 1. 2. 3. 4. 5. 6. 7. 8. 再看另一个查询,选择同样多的记录但是仅仅索引列。不需要heap页因次没有随机IO,因此这个查询选择index only scan而不是bitmap scan。 postgres=# explain...
Bitmap Heap Scan on bms_test (cost=380.46..7002.12 rows=20133 width=19) (actual time=2.404..11.359 rows=19978 loops=1) Recheck Cond: (b = 44) Heap Blocks: exact=6114 -> Bitmap Index Scan on idx_bms_b (cost=0.00..375.42 rows=20133 width=0) (actual time=1.585..1.585 rows=19978 ...
T_IndexPath, pathtype = T_IndexScan, parent = 0x2aa6658, pathtarget = 0x2aad8d8, param_info = 0x0, parallel_aware = false, parallel_safe = true, parallel_workers = 0, rows = 3156, startup_cost = 0.28500000000000003, total_cost = 191.46871600907946, pathkeys = 0x0}, indexinfo =...
Recheck Cond: (letter='d'::text)-> Bitmap Index Scan on i_sample (cost=0.00..4.29rows=5width=0) Index Cond: (letter='d'::text) (4rows) postgres=# postgres=# EXPLAIN SELECT *FROM sample WHERE letter='k'; QUERY PLAN---Index Scanusingi_sample on sample (cost=0.00..8.27rows=1wi...
{type = T_IndexPath, pathtype = T_IndexScan, parent = 0x1666a48, pathtarget = 0x166d988, param_info = 0x0, parallel_aware = false, parallel_safe = true, parallel_workers = 0, rows = 33, startup_cost = 0.28500000000000003, total_cost = 111.33157683302848, pathkeys = 0x0}, index...
Recheck Cond: (letter='d'::text)-> Bitmap Index Scan on i_sample (cost=0.00..4.29rows=5width=0) Index Cond: (letter='d'::text) (4rows) postgres=# postgres=# EXPLAIN SELECT *FROM sample WHERE letter='k'; QUERY PLAN---Index Scanusingi_sample on sample (cost=0.00..8.27rows=1wi...
-> Bitmap Index Scan on test_bitmap_foo_idx (actual time=0.634..0.641 rows=1 loops=1) Index Cond: (foo = 52) -> Bitmap Index Scan on test_bitmap_bar_idx (actual time=0.237..0.260 rows=1 loops=1) Index Cond: (bar = 520) ...
Recheck Cond: (letter='d'::text)-> Bitmap Index Scan on i_sample (cost=0.00..4.29rows=5width=0) Index Cond: (letter='d'::text) (4rows) postgres=# postgres=# EXPLAIN SELECT *FROM sample WHERE letter='k'; QUERY PLAN---Index Scanusingi_sample on sample (cost=0.00..8.27rows=1wi...
-->BitmapAnd -> Bitmap Index Scan on t_dwxx_pkey (cost=0.00..13.86rows=557width=0) Index Cond: (((t1.dwbh)::text >10000::text)AND((t1.dwbh)::text <15000::text)) -> Bitmap Index Scan on idx_dwxx_dwdz (cost=0.00..18.21rows=592width=0) Index Cond: (((t1.dwdz)::text...