Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE table1 (id serial primary key, col1 real, col2 real, ..., coln real)
- EXPLAIN ANALYZE SELECT col1, col12, col22, col17, col41, col27 FROM table1 WHERE table1.id=461 OR table1.id=7618 OR table1.id=45581 OR table1.id=5238;
- Bitmap Heap Scan on table1 (cost=9.72..17.76 rows=4 width=24) (actual time=28.290..45.165 rows=4 loops=1)
- Recheck Cond: ((id = 461) OR (id = 7618) OR (id = 45581) OR (id = 5238))
- Heap Blocks: exact=4
- -> BitmapOr (cost=9.72..9.72 rows=4 width=0) (actual time=16.748..16.748 rows=0 loops=1)
- -> Bitmap Index Scan on table1_pkey (cost=0.00..2.43 rows=1 width=0) (actual time=11.230..11.230 rows=1 loops=1)
- Index Cond: (id = 461)
- -> Bitmap Index Scan on table1_pkey (cost=0.00..2.43 rows=1 width=0) (actual time=0.832..0.832 rows=1 loops=1)
- Index Cond: (id = 7618)
- -> Bitmap Index Scan on table1_pkey (cost=0.00..2.43 rows=1 width=0) (actual time=4.476..4.476 rows=1 loops=1)
- Index Cond: (id = 45581)
- -> Bitmap Index Scan on table1_pkey (cost=0.00..2.43 rows=1 width=0) (actual time=0.208..0.208 rows=1 loops=1)
- Index Cond: (id = 5238)
- Planning time: 0.074 ms
- Execution time: 45.197 ms
- (14 rows)
- Bitmap Heap Scan on table1 (cost=9.72..17.76 rows=4 width=24) (actual time=0.031..0.036 rows=4 loops=1)
- Recheck Cond: ((id = 461) OR (id = 7618) OR (id = 45581) OR (id = 5238))
- Heap Blocks: exact=4
- -> BitmapOr (cost=9.72..9.72 rows=4 width=0) (actual time=0.024..0.024 rows=0 loops=1)
- -> Bitmap Index Scan on table1_pkey (cost=0.00..2.43 rows=1 width=0) (actual time=0.012..0.012 rows=1 loops=1)
- Index Cond: (id = 461)
- -> Bitmap Index Scan on table1_pkey (cost=0.00..2.43 rows=1 width=0) (actual time=0.005..0.005 rows=1 loops=1)
- Index Cond: (id = 7618)
- -> Bitmap Index Scan on table1_pkey (cost=0.00..2.43 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=1)
- Index Cond: (id = 45581)
- -> Bitmap Index Scan on table1_pkey (cost=0.00..2.43 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=1)
- Index Cond: (id = 5238)
- Planning time: 0.078 ms
- Execution time: 0.074 ms
- (14 rows)
- EXPLAIN ANALYZE SELECT col1, col12, col22, col17, col41, col27 FROM table1 WHERE table1.id IN(461,7618,45581,5238);
- EXPLAIN ANALYZE
- (SELECT col1, col12, col22, col17, col41, col27 FROM table1 WHERE table1.id=461
- UNION
- SELECT col1, col12, col22, col17, col41, col27 FROM table1 WHERE table1.id=7618
- UNION
- SELECT col1, col12, col22, col17, col41, col27 FROM table1 WHERE table1.id=45581
- UNION
- SELECT col1, col12, col22, col17, col41, col27 FROM table1 table1.id=5238);
Add Comment
Please, Sign In to add comment