Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ========== Query 1 ==========
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE release_group IN (SELECT id FROM mb.release_group WHERE name = 'Bear');
- QUERY PLAN
- ---------------------------------------------------------------------------------------------------------------------------------------------
- Nested Loop (cost=0.85..50.97 rows=6 width=4) (actual time=0.060..0.094 rows=3 loops=1)
- Buffers: shared hit=13
- -> Index Scan using release_group_idx_name on release_group (cost=0.43..16.47 rows=3 width=4) (actual time=0.039..0.043 rows=2 loops=1)
- Index Cond: ((name)::text = 'Bear'::text)
- Buffers: shared hit=5
- -> Index Scan using release_idx_release_group on release (cost=0.43..11.48 rows=2 width=8) (actual time=0.010..0.013 rows=2 loops=2)
- Index Cond: (release_group = release_group.id)
- Buffers: shared hit=8
- Planning time: 0.552 ms
- Execution time: 0.147 ms
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE release_group = ANY(ARRAY(SELECT id FROM mb.release_group WHERE name = 'Bear'));
- QUERY PLAN
- -----------------------------------------------------------------------------------------------------------------------------------------------
- Index Scan using release_idx_release_group on release (cost=16.90..119.37 rows=19 width=4) (actual time=0.085..0.098 rows=3 loops=1)
- Index Cond: (release_group = ANY ($0))
- Buffers: shared hit=13
- InitPlan 1 (returns $0)
- -> Index Scan using release_group_idx_name on release_group (cost=0.43..16.47 rows=3 width=4) (actual time=0.048..0.052 rows=2 loops=1)
- Index Cond: ((name)::text = 'Bear'::text)
- Buffers: shared hit=5
- Planning time: 0.265 ms
- Execution time: 0.143 ms
- ========== Query 2 ==========
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE release_group IN (SELECT id FROM mb.release_group WHERE name < 'Bear');
- QUERY PLAN
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- Hash Semi Join (cost=23245.00..82931.97 rows=264858 width=4) (actual time=503.764..5790.509 rows=163703 loops=1)
- Hash Cond: (release.release_group = release_group.id)
- Buffers: shared hit=16082 read=23866, temp read=2886 written=2884
- -> Seq Scan on release (cost=0.00..39750.62 rows=1575162 width=8) (actual time=0.014..2517.955 rows=1575162 loops=1)
- Buffers: shared hit=133 read=23866
- -> Hash (cost=20941.20..20941.20 rows=140384 width=4) (actual time=502.453..502.453 rows=135215 loops=1)
- Buckets: 131072 Batches: 2 Memory Usage: 3409kB
- Buffers: shared hit=15949, temp written=197
- -> Bitmap Heap Scan on release_group (cost=3976.40..20941.20 rows=140384 width=4) (actual time=87.192..303.230 rows=135215 loops=1)
- Recheck Cond: ((name)::text < 'Bear'::text)
- Heap Blocks: exact=15203
- Buffers: shared hit=15949
- -> Bitmap Index Scan on release_group_idx_name (cost=0.00..3941.31 rows=140384 width=0) (actual time=83.749..83.749 rows=135215 loops=1)
- Index Cond: ((name)::text < 'Bear'::text)
- Buffers: shared hit=746
- Planning time: 0.646 ms
- Execution time: 6000.449 ms
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE release_group = ANY(ARRAY(SELECT id FROM mb.release_group WHERE name < 'Bear'));
- QUERY PLAN
- ------------------------------------------------------------------------------------------------------------------------------------------------------
- Index Scan using release_idx_release_group on release (cost=20941.63..21044.10 rows=19 width=4) (actual time=728.155..2303.396 rows=163703 loops=1)
- Index Cond: (release_group = ANY ($0))
- Buffers: shared hit=499269 read=62795
- InitPlan 1 (returns $0)
- -> Bitmap Heap Scan on release_group (cost=3976.40..20941.20 rows=140384 width=4) (actual time=94.026..489.196 rows=135215 loops=1)
- Recheck Cond: ((name)::text < 'Bear'::text)
- Heap Blocks: exact=15203
- Buffers: shared hit=1 read=15948
- -> Bitmap Index Scan on release_group_idx_name (cost=0.00..3941.31 rows=140384 width=0) (actual time=90.334..90.334 rows=135215 loops=1)
- Index Cond: ((name)::text < 'Bear'::text)
- Buffers: shared read=746
- Planning time: 0.364 ms
- Execution time: 2517.406 ms
- ========== Query 3 ==========
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE name = 'Tiger' OR release_group IN (SELECT id FROM mb.release_group WHERE name = 'Bear');
- QUERY PLAN
- -----------------------------------------------------------------------------------------------------------------------------------------------
- Seq Scan on release (cost=16.48..47642.91 rows=787583 width=4) (actual time=122.779..710.886 rows=11 loops=1)
- Filter: (((name)::text = 'Tiger'::text) OR (hashed SubPlan 1))
- Rows Removed by Filter: 1575151
- Buffers: shared hit=14065 read=9939
- SubPlan 1
- -> Index Scan using release_group_idx_name on release_group (cost=0.43..16.47 rows=3 width=4) (actual time=0.044..0.049 rows=2 loops=1)
- Index Cond: ((name)::text = 'Bear'::text)
- Buffers: shared hit=5
- Planning time: 0.286 ms
- Execution time: 710.976 ms
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE name = 'Tiger' OR release_group = ANY(ARRAY(SELECT id FROM mb.release_group WHERE name = 'Bear'));
- QUERY PLAN
- -----------------------------------------------------------------------------------------------------------------------------------------------
- Bitmap Heap Scan on release (cost=65.37..159.70 rows=24 width=4) (actual time=0.141..0.172 rows=11 loops=1)
- Recheck Cond: (((name)::text = 'Tiger'::text) OR (release_group = ANY ($0)))
- Heap Blocks: exact=9
- Buffers: shared hit=23
- InitPlan 1 (returns $0)
- -> Index Scan using release_group_idx_name on release_group (cost=0.43..16.47 rows=3 width=4) (actual time=0.032..0.037 rows=2 loops=1)
- Index Cond: ((name)::text = 'Bear'::text)
- Buffers: shared hit=5
- -> BitmapOr (cost=48.90..48.90 rows=24 width=0) (actual time=0.131..0.131 rows=0 loops=1)
- Buffers: shared hit=14
- -> Bitmap Index Scan on release_idx_name (cost=0.00..4.46 rows=5 width=0) (actual time=0.049..0.049 rows=8 loops=1)
- Index Cond: ((name)::text = 'Tiger'::text)
- Buffers: shared hit=3
- -> Bitmap Index Scan on release_idx_release_group (cost=0.00..44.42 rows=19 width=0) (actual time=0.074..0.074 rows=3 loops=1)
- Index Cond: (release_group = ANY ($0))
- Buffers: shared hit=11
- Planning time: 0.302 ms
- Execution time: 0.245 ms
- ========== Query 4 ==========
- EXPLAIN SELECT id FROM mb.release WHERE name = 'Tiger' OR release_group IN (SELECT id FROM mb.release_group WHERE name < 'Bear');
- QUERY PLAN
- -----------------------------------------------------------------------------------------------------------
- Seq Scan on release (cost=3976.40..14622816003.91 rows=787583 width=4)
- Filter: (((name)::text = 'Tiger'::text) OR (SubPlan 1))
- SubPlan 1
- -> Materialize (cost=3976.40..22192.12 rows=140384 width=4)
- -> Bitmap Heap Scan on release_group (cost=3976.40..20941.20 rows=140384 width=4)
- Recheck Cond: ((name)::text < 'Bear'::text)
- -> Bitmap Index Scan on release_group_idx_name (cost=0.00..3941.31 rows=140384 width=0)
- Index Cond: ((name)::text < 'Bear'::text)
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE name = 'Tiger' OR release_group = ANY(ARRAY(SELECT id FROM mb.release_group WHERE name < 'Bear'));
- QUERY PLAN
- ------------------------------------------------------------------------------------------------------------------------------------------------------
- Bitmap Heap Scan on release (cost=20990.11..21084.43 rows=24 width=4) (actual time=1178.843..1754.903 rows=163711 loops=1)
- Recheck Cond: (((name)::text = 'Tiger'::text) OR (release_group = ANY ($0)))
- Heap Blocks: exact=23948
- Buffers: shared hit=402089 read=44221
- InitPlan 1 (returns $0)
- -> Bitmap Heap Scan on release_group (cost=3976.40..20941.20 rows=140384 width=4) (actual time=102.120..498.496 rows=135215 loops=1)
- Recheck Cond: ((name)::text < 'Bear'::text)
- Heap Blocks: exact=15203
- Buffers: shared read=15949
- -> Bitmap Index Scan on release_group_idx_name (cost=0.00..3941.31 rows=140384 width=0) (actual time=98.245..98.245 rows=135215 loops=1)
- Index Cond: ((name)::text < 'Bear'::text)
- Buffers: shared read=746
- -> BitmapOr (cost=48.90..48.90 rows=24 width=0) (actual time=1171.686..1171.686 rows=0 loops=1)
- Buffers: shared hit=402089 read=20273
- -> Bitmap Index Scan on release_idx_name (cost=0.00..4.46 rows=5 width=0) (actual time=0.108..0.108 rows=8 loops=1)
- Index Cond: ((name)::text = 'Tiger'::text)
- Buffers: shared read=3
- -> Bitmap Index Scan on release_idx_release_group (cost=0.00..44.42 rows=19 width=0) (actual time=1171.569..1171.569 rows=163703 loops=1)
- Index Cond: (release_group = ANY ($0))
- Buffers: shared hit=402089 read=20270
- Planning time: 0.402 ms
- Execution time: 1962.152 ms
- ========== Query 5 ==========
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE name = 'Tiger' AND release_group IN (SELECT id FROM mb.release_group WHERE name = 'Bear');
- QUERY PLAN
- ---------------------------------------------------------------------------------------------------------------------------------------------
- Nested Loop (cost=0.85..41.21 rows=1 width=4) (actual time=0.178..0.178 rows=0 loops=1)
- Join Filter: (release.release_group = release_group.id)
- Rows Removed by Join Filter: 16
- Buffers: shared hit=15
- -> Index Scan using release_group_idx_name on release_group (cost=0.43..16.47 rows=3 width=4) (actual time=0.039..0.044 rows=2 loops=1)
- Index Cond: ((name)::text = 'Bear'::text)
- Buffers: shared hit=5
- -> Materialize (cost=0.43..24.52 rows=5 width=8) (actual time=0.018..0.046 rows=8 loops=2)
- Buffers: shared hit=10
- -> Index Scan using release_idx_name on release (cost=0.43..24.50 rows=5 width=8) (actual time=0.028..0.052 rows=8 loops=1)
- Index Cond: ((name)::text = 'Tiger'::text)
- Buffers: shared hit=10
- Planning time: 0.590 ms
- Execution time: 0.226 ms
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE name = 'Tiger' AND release_group = ANY(ARRAY(SELECT id FROM mb.release_group WHERE name = 'Bear'));
- QUERY PLAN
- -----------------------------------------------------------------------------------------------------------------------------------------------
- Index Scan using release_idx_name on release (cost=16.90..41.03 rows=1 width=4) (actual time=0.109..0.109 rows=0 loops=1)
- Index Cond: ((name)::text = 'Tiger'::text)
- Filter: (release_group = ANY ($0))
- Rows Removed by Filter: 8
- Buffers: shared hit=15
- InitPlan 1 (returns $0)
- -> Index Scan using release_group_idx_name on release_group (cost=0.43..16.47 rows=3 width=4) (actual time=0.028..0.034 rows=2 loops=1)
- Index Cond: ((name)::text = 'Bear'::text)
- Buffers: shared hit=5
- Planning time: 0.304 ms
- Execution time: 0.152 ms
- ========== Query 6 ==========
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE name = 'Tiger' AND release_group IN (SELECT id FROM mb.release_group WHERE name < 'Bear');
- QUERY PLAN
- ----------------------------------------------------------------------------------------------------------------------------------------
- Nested Loop Semi Join (cost=0.85..66.74 rows=1 width=4) (actual time=0.198..0.198 rows=0 loops=1)
- Buffers: shared hit=42
- -> Index Scan using release_idx_name on release (cost=0.43..24.50 rows=5 width=8) (actual time=0.034..0.057 rows=8 loops=1)
- Index Cond: ((name)::text = 'Tiger'::text)
- Buffers: shared hit=10
- -> Index Scan using release_group_pkey on release_group (cost=0.43..8.45 rows=1 width=4) (actual time=0.011..0.011 rows=0 loops=8)
- Index Cond: (id = release.release_group)
- Filter: ((name)::text < 'Bear'::text)
- Rows Removed by Filter: 1
- Buffers: shared hit=32
- Planning time: 0.693 ms
- Execution time: 0.248 ms
- EXPLAIN (ANALYZE, BUFFERS) SELECT id FROM mb.release WHERE name = 'Tiger' AND release_group = ANY(ARRAY(SELECT id FROM mb.release_group WHERE name < 'Bear'));
- QUERY PLAN
- ------------------------------------------------------------------------------------------------------------------------------------------------------
- Index Scan using release_idx_name on release (cost=20941.63..20965.76 rows=1 width=4) (actual time=491.891..491.891 rows=0 loops=1)
- Index Cond: ((name)::text = 'Tiger'::text)
- Filter: (release_group = ANY ($0))
- Rows Removed by Filter: 8
- Buffers: shared hit=15959
- InitPlan 1 (returns $0)
- -> Bitmap Heap Scan on release_group (cost=3976.40..20941.20 rows=140384 width=4) (actual time=88.227..303.389 rows=135215 loops=1)
- Recheck Cond: ((name)::text < 'Bear'::text)
- Heap Blocks: exact=15203
- Buffers: shared hit=15949
- -> Bitmap Index Scan on release_group_idx_name (cost=0.00..3941.31 rows=140384 width=0) (actual time=84.414..84.414 rows=135215 loops=1)
- Index Cond: ((name)::text < 'Bear'::text)
- Buffers: shared hit=746
- Planning time: 0.413 ms
- Execution time: 492.248 ms
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement