从Plan来看,Bitmap Scan也分为两个阶段:Bitmap Index Scan和Bitmap Heap Scan。通过对比三种扫描算子的Plan输出可以发现,当前SQL,使用位图扫描的代价是最低的:Bitmap scan cost(11559.98) < index scan cost(32243.95) < seq scan cost(35811)位图扫描源码解析 位图扫描分为Bitmap Index Scan和Bitmap H...
Recheck Cond: ((application_id)::text<'50000'::text)Filter: ((family_id)::text>'5000'::text)RowsRemovedbyFilter:4444449Heap Blocks: exact=32924->Bitmap Index Scanonidx_test1 (cost=0.00..82701.89rows=4463128width=0) (actualtime=541.293..541.293rows=4444449loops=1) Index Cond: ((applicatio...
-- Bitmap Heap Scan on public.t_dwxx t1 (cost=32.33..88.38 rows=33 width=20) Output: dwmc, dwbh, dwdz Recheck Cond: (((t1.dwbh)::text > '10000'::text) AND ((t1.dwbh)::text < '15000'::text) AND ((t1.dwdz)::text ...
Bitmap Heap Scan on public.test (cost=808.96..13148.92rows=23402width=36) (actualtime=14.295..52.321rows=29605loops=1) Output: id, arr Recheck Cond: (test.arr &&'{1,2,3}'::integer[]) Heap Blocks:exact=11240 Buffers: sharedhit=11764 -> Bitmap Index Scan on idx_test_1 (cost=0.00....
Bitmap Heap Scan on account1 (cost=49.94..1021.13 rows=250 width=19) (actual time=0.130..0.131 rows=1 loops=1) Recheck Cond: (tag @> '{61568,97350}'::integer[]) Heap Blocks: exact=1 -> Bitmap Index Scan on tag_inx_2 (cost=0.00..49.87 rows=250 width=0) (actual time=0.125....
testdb=# explain verbose select t1.* from t_dwxx t1 where dwbh > '1000' and dwbh < '3000';QUERYPLAN---Bitmap Heap Scan onpublic.t_dwxx t1(cost=51.07..148.42rows=2223width=20)Output:dwmc,dwbh,dwdz Recheck Cond:(((t1.dwbh)::text>'1000'::text)AND((t1.dwbh)::text<'3000'::...
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...
Bitmap Heap Scan on t1 (cost=3.31..4.62 rows=1 width=12) Recheck Cond: ((c3 = 30) AND (c2 = 20)) Filter: (c1 = 10) -> BitmapAnd (cost=3.31..3.31 rows=1 width=0) -> Bitmap Index Scan on idx_t13 (cost=0.00..1.53 rows=10 width=0) ...
Index Cond: (id=100)-> Bitmap Index Scan on idx_id_dept (cost=0.00..4.26rows=1width=0) (actual time=0.008..0.008rows=1loops=1) Index Cond: (id=300) Total runtime:42.876ms (8rows) postgres=# 就是说,bitmap index scan 就相当于 index scan。只是它们需要组合起结果来,所以被称为 Bit...
Bitmap Heap Scan on account (cost=52.81..466.86rows=105width=19) (actual time=4.263..4.502rows= 184loops=1) Recheck Cond: (tag @>'{GN,o}'::text[]) Heap Blocks: exact=184 -> Bitmap Index Scan on tag_inx (cost=0.00..52.78rows=105width=0) (actual time=4.240..4.240r ...