Skip to content

Commit a51ec08

Browse files
committed
Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes
It looks like the example case was once modified to increase the number of rows but the EXPLAIN ANALYZE output wasn't updated to reflect that. Also adjust the text which discusses the index sizes. With the example table size, the bloom index isn't quite 8 times more space efficient than the btree indexes. Discussion: https://postgr.es/m/CAApHDvovx8kQ0=HTt85gFDAwmTJHpCgiSvRmQZ_6u_g-vQYM_w@mail.gmail.com Backpatch-through: 13, all supported versions
1 parent 4d20bad commit a51ec08

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

doc/src/sgml/bloom.sgml

+24-24
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ SELECT 10000000
118118
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
119119
QUERY PLAN
120120
-------------------------------------------------------------------&zwsp;-----------------------------------
121-
Seq Scan on tbloom (cost=0.00..2137.14 rows=3 width=24) (actual time=15.480..15.480 rows=0 loops=1)
121+
Seq Scan on tbloom (cost=0.00..213744.00 rows=250 width=24) (actual time=357.059..357.059 rows=0 loops=1)
122122
Filter: ((i2 = 898732) AND (i5 = 123451))
123-
Rows Removed by Filter: 100000
124-
Planning Time: 0.340 ms
125-
Execution Time: 15.501 ms
123+
Rows Removed by Filter: 10000000
124+
Planning Time: 0.346 ms
125+
Execution Time: 357.076 ms
126126
(5 rows)
127127
</programlisting>
128128
</para>
@@ -136,16 +136,16 @@ CREATE INDEX
136136
=# SELECT pg_size_pretty(pg_relation_size('btreeidx'));
137137
pg_size_pretty
138138
----------------
139-
3976 kB
139+
386 MB
140140
(1 row)
141141
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
142142
QUERY PLAN
143143
-------------------------------------------------------------------&zwsp;-----------------------------------
144-
Seq Scan on tbloom (cost=0.00..2137.00 rows=2 width=24) (actual time=12.604..12.604 rows=0 loops=1)
144+
Seq Scan on tbloom (cost=0.00..213744.00 rows=2 width=24) (actual time=351.016..351.017 rows=0 loops=1)
145145
Filter: ((i2 = 898732) AND (i5 = 123451))
146-
Rows Removed by Filter: 100000
147-
Planning Time: 0.155 ms
148-
Execution Time: 12.617 ms
146+
Rows Removed by Filter: 10000000
147+
Planning Time: 0.138 ms
148+
Execution Time: 351.035 ms
149149
(5 rows)
150150
</programlisting>
151151
</para>
@@ -159,19 +159,19 @@ CREATE INDEX
159159
=# SELECT pg_size_pretty(pg_relation_size('bloomidx'));
160160
pg_size_pretty
161161
----------------
162-
1584 kB
162+
153 MB
163163
(1 row)
164164
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
165165
QUERY PLAN
166166
-------------------------------------------------------------------&zwsp;--------------------------------------------------
167-
Bitmap Heap Scan on tbloom (cost=1792.00..1799.69 rows=2 width=24) (actual time=0.384..0.384 rows=0 loops=1)
167+
Bitmap Heap Scan on tbloom (cost=1792.00..1799.69 rows=2 width=24) (actual time=22.605..22.606 rows=0 loops=1)
168168
Recheck Cond: ((i2 = 898732) AND (i5 = 123451))
169-
Rows Removed by Index Recheck: 26
170-
Heap Blocks: exact=26
171-
-&gt; Bitmap Index Scan on bloomidx (cost=0.00..1792.00 rows=2 width=0) (actual time=0.350..0.350 rows=26 loops=1)
169+
Rows Removed by Index Recheck: 2300
170+
Heap Blocks: exact=2256
171+
-&gt; Bitmap Index Scan on bloomidx (cost=0.00..178436.00 rows=1 width=0) (actual time=20.005..20.005 rows=2300 loops=1)
172172
Index Cond: ((i2 = 898732) AND (i5 = 123451))
173-
Planning Time: 0.122 ms
174-
Execution Time: 0.407 ms
173+
Planning Time: 0.099 ms
174+
Execution Time: 22.632 ms
175175
(8 rows)
176176
</programlisting>
177177
</para>
@@ -197,21 +197,21 @@ CREATE INDEX
197197
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
198198
QUERY PLAN
199199
-------------------------------------------------------------------&zwsp;--------------------------------------------------------
200-
Bitmap Heap Scan on tbloom (cost=24.34..32.03 rows=2 width=24) (actual time=0.032..0.033 rows=0 loops=1)
200+
Bitmap Heap Scan on tbloom (cost=9.29..13.30 rows=1 width=24) (actual time=0.032..0.033 rows=0 loops=1)
201201
Recheck Cond: ((i5 = 123451) AND (i2 = 898732))
202-
-&gt; BitmapAnd (cost=24.34..24.34 rows=2 width=0) (actual time=0.029..0.030 rows=0 loops=1)
203-
-&gt; Bitmap Index Scan on btreeidx5 (cost=0.00..12.04 rows=500 width=0) (actual time=0.029..0.029 rows=0 loops=1)
202+
-&gt; BitmapAnd (cost=9.29..9.29 rows=1 width=0) (actual time=0.047..0.047 rows=0 loops=1)
203+
-&gt; Bitmap Index Scan on btreeidx5 (cost=0.00..4.52 rows=11 width=0) (actual time=0.026..0.026 rows=7 loops=1)
204204
Index Cond: (i5 = 123451)
205-
-&gt; Bitmap Index Scan on btreeidx2 (cost=0.00..12.04 rows=500 width=0) (never executed)
205+
-&gt; Bitmap Index Scan on btreeidx2 (cost=0.00..4.52 rows=11 width=0) (actual time=0.007..0.007 rows=8 loops=1)
206206
Index Cond: (i2 = 898732)
207-
Planning Time: 0.537 ms
208-
Execution Time: 0.064 ms
207+
Planning Time: 0.264 ms
208+
Execution Time: 0.047 ms
209209
(9 rows)
210210
</programlisting>
211211
Although this query runs much faster than with either of the single
212212
indexes, we pay a penalty in index size. Each of the single-column
213-
btree indexes occupies 2 MB, so the total space needed is 12 MB,
214-
eight times the space used by the bloom index.
213+
btree indexes occupies 88.5 MB, so the total space needed is 531 MB,
214+
over three times the space used by the bloom index.
215215
</para>
216216
</sect2>
217217

0 commit comments

Comments
 (0)