@@ -210,11 +210,11 @@ SELECT 10000000
210
210
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
211
211
QUERY PLAN
212
212
-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-&zwsp;-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-
213
- Seq Scan on tbloom (cost=0.00..2137.14 rows=3 width=24) (actual time=15.480..15.480 rows=0 loops=1)
213
+ Seq Scan on tbloom (cost=0.00..2137.14 rows=3 width=24) (actual time=16.971..16.971 rows=0 loops=1)
214
214
Filter: ((i2 = 898732) AND (i5 = 123451))
215
215
Rows Removed by Filter: 100000
216
- Planning Time: 0.340 ms
217
- Execution Time: 15.501 ms
216
+ Planning Time: 0.346 ms
217
+ Execution Time: 16.988 ms
218
218
(5 rows)
219
219
</programlisting>
220
220
</para>
@@ -225,11 +225,11 @@ ____________________________________________________________________________-->
225
225
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
226
226
QUERY PLAN
227
227
-------------------------------------------------------------------&zwsp;-----------------------------------
228
- Seq Scan on tbloom (cost=0.00..2137.14 rows=3 width=24) (actual time=15.480..15.480 rows=0 loops=1)
228
+ Seq Scan on tbloom (cost=0.00..2137.14 rows=3 width=24) (actual time=16.971..16.971 rows=0 loops=1)
229
229
Filter: ((i2 = 898732) AND (i5 = 123451))
230
230
Rows Removed by Filter: 100000
231
- Planning Time: 0.340 ms
232
- Execution Time: 15.501 ms
231
+ Planning Time: 0.346 ms
232
+ Execution Time: 16.988 ms
233
233
(5 rows)
234
234
</programlisting>
235
235
</para>
@@ -249,11 +249,11 @@ CREATE INDEX
249
249
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
250
250
QUERY PLAN
251
251
-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-&zwsp;-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-
252
- Seq Scan on tbloom (cost=0.00..2137.00 rows=2 width=24) (actual time=12.604 ..12.604 rows=0 loops=1)
252
+ Seq Scan on tbloom (cost=0.00..2137.00 rows=2 width=24) (actual time=12.805 ..12.805 rows=0 loops=1)
253
253
Filter: ((i2 = 898732) AND (i5 = 123451))
254
254
Rows Removed by Filter: 100000
255
- Planning Time: 0.155 ms
256
- Execution Time: 12.617 ms
255
+ Planning Time: 0.138 ms
256
+ Execution Time: 12.817 ms
257
257
(5 rows)
258
258
</programlisting>
259
259
</para>
@@ -271,11 +271,11 @@ CREATE INDEX
271
271
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
272
272
QUERY PLAN
273
273
-------------------------------------------------------------------&zwsp;-----------------------------------
274
- Seq Scan on tbloom (cost=0.00..2137.00 rows=2 width=24) (actual time=12.604 ..12.604 rows=0 loops=1)
274
+ Seq Scan on tbloom (cost=0.00..2137.00 rows=2 width=24) (actual time=12.805 ..12.805 rows=0 loops=1)
275
275
Filter: ((i2 = 898732) AND (i5 = 123451))
276
276
Rows Removed by Filter: 100000
277
- Planning Time: 0.155 ms
278
- Execution Time: 12.617 ms
277
+ Planning Time: 0.138 ms
278
+ Execution Time: 12.817 ms
279
279
(5 rows)
280
280
</programlisting>
281
281
</para>
@@ -295,14 +295,14 @@ CREATE INDEX
295
295
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
296
296
QUERY PLAN
297
297
-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-&zwsp;-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−
298
- Bitmap Heap Scan on tbloom (cost=1792.00..1799.69 rows=2 width=24) (actual time=0.384 ..0.384 rows=0 loops=1)
298
+ Bitmap Heap Scan on tbloom (cost=1792.00..1799.69 rows=2 width=24) (actual time=0.388 ..0.388 rows=0 loops=1)
299
299
Recheck Cond: ((i2 = 898732) AND (i5 = 123451))
300
- Rows Removed by Index Recheck: 26
301
- Heap Blocks: exact=26
302
- -> Bitmap Index Scan on bloomidx (cost=0.00..1792.00 rows=2 width=0) (actual time=0.350 ..0.350 rows=26 loops=1)
300
+ Rows Removed by Index Recheck: 29
301
+ Heap Blocks: exact=28
302
+ -> Bitmap Index Scan on bloomidx (cost=0.00..1792.00 rows=2 width=0) (actual time=0.356 ..0.356 rows=29 loops=1)
303
303
Index Cond: ((i2 = 898732) AND (i5 = 123451))
304
- Planning Time: 0.122 ms
305
- Execution Time: 0.407 ms
304
+ Planning Time: 0.099 ms
305
+ Execution Time: 0.408 ms
306
306
(8 rows)
307
307
</programlisting>
308
308
</para>
@@ -320,14 +320,14 @@ CREATE INDEX
320
320
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
321
321
QUERY PLAN
322
322
-------------------------------------------------------------------&zwsp;--------------------------------------------------
323
- Bitmap Heap Scan on tbloom (cost=1792.00..1799.69 rows=2 width=24) (actual time=0.384 ..0.384 rows=0 loops=1)
323
+ Bitmap Heap Scan on tbloom (cost=1792.00..1799.69 rows=2 width=24) (actual time=0.388 ..0.388 rows=0 loops=1)
324
324
Recheck Cond: ((i2 = 898732) AND (i5 = 123451))
325
- Rows Removed by Index Recheck: 26
326
- Heap Blocks: exact=26
327
- -> Bitmap Index Scan on bloomidx (cost=0.00..1792.00 rows=2 width=0) (actual time=0.350 ..0.350 rows=26 loops=1)
325
+ Rows Removed by Index Recheck: 29
326
+ Heap Blocks: exact=28
327
+ -> Bitmap Index Scan on bloomidx (cost=0.00..1792.00 rows=2 width=0) (actual time=0.356 ..0.356 rows=29 loops=1)
328
328
Index Cond: ((i2 = 898732) AND (i5 = 123451))
329
- Planning Time: 0.122 ms
330
- Execution Time: 0.407 ms
329
+ Planning Time: 0.099 ms
330
+ Execution Time: 0.408 ms
331
331
(8 rows)
332
332
</programlisting>
333
333
</para>
@@ -354,15 +354,15 @@ CREATE INDEX
354
354
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
355
355
QUERY PLAN
356
356
-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-&zwsp;-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−-−
357
- Bitmap Heap Scan on tbloom (cost=24.34..32.03 rows=2 width=24) (actual time=0.032 ..0.033 rows=0 loops=1)
357
+ Bitmap Heap Scan on tbloom (cost=24.34..32.03 rows=2 width=24) (actual time=0.028 ..0.029 rows=0 loops=1)
358
358
Recheck Cond: ((i5 = 123451) AND (i2 = 898732))
359
- -> BitmapAnd (cost=24.34..24.34 rows=2 width=0) (actual time=0.029 ..0.030 rows=0 loops=1)
360
- -> Bitmap Index Scan on btreeidx5 (cost=0.00..12.04 rows=500 width=0) (actual time=0.029 ..0.029 rows=0 loops=1)
359
+ -> BitmapAnd (cost=24.34..24.34 rows=2 width=0) (actual time=0.027 ..0.027 rows=0 loops=1)
360
+ -> Bitmap Index Scan on btreeidx5 (cost=0.00..12.04 rows=500 width=0) (actual time=0.026 ..0.026 rows=0 loops=1)
361
361
Index Cond: (i5 = 123451)
362
362
-> Bitmap Index Scan on btreeidx2 (cost=0.00..12.04 rows=500 width=0) (never executed)
363
363
Index Cond: (i2 = 898732)
364
- Planning Time: 0.537 ms
365
- Execution Time: 0.064 ms
364
+ Planning Time: 0.491 ms
365
+ Execution Time: 0.055 ms
366
366
(9 rows)
367
367
</programlisting>
368
368
Although this query runs much faster than with either of the single
@@ -389,15 +389,15 @@ CREATE INDEX
389
389
=# EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
390
390
QUERY PLAN
391
391
-------------------------------------------------------------------&zwsp;--------------------------------------------------------
392
- Bitmap Heap Scan on tbloom (cost=24.34..32.03 rows=2 width=24) (actual time=0.032 ..0.033 rows=0 loops=1)
392
+ Bitmap Heap Scan on tbloom (cost=24.34..32.03 rows=2 width=24) (actual time=0.028 ..0.029 rows=0 loops=1)
393
393
Recheck Cond: ((i5 = 123451) AND (i2 = 898732))
394
- -> BitmapAnd (cost=24.34..24.34 rows=2 width=0) (actual time=0.029 ..0.030 rows=0 loops=1)
395
- -> Bitmap Index Scan on btreeidx5 (cost=0.00..12.04 rows=500 width=0) (actual time=0.029 ..0.029 rows=0 loops=1)
394
+ -> BitmapAnd (cost=24.34..24.34 rows=2 width=0) (actual time=0.027 ..0.027 rows=0 loops=1)
395
+ -> Bitmap Index Scan on btreeidx5 (cost=0.00..12.04 rows=500 width=0) (actual time=0.026 ..0.026 rows=0 loops=1)
396
396
Index Cond: (i5 = 123451)
397
397
-> Bitmap Index Scan on btreeidx2 (cost=0.00..12.04 rows=500 width=0) (never executed)
398
398
Index Cond: (i2 = 898732)
399
- Planning Time: 0.537 ms
400
- Execution Time: 0.064 ms
399
+ Planning Time: 0.491 ms
400
+ Execution Time: 0.055 ms
401
401
(9 rows)
402
402
</programlisting>
403
403
尽管这个查询运行起来比在其中任一单个索引上都快,但是我们在索引尺寸上付出了代价。
0 commit comments