Guest User

Untitled

a guest
Jan 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. CREATE TABLE table1 (id serial primary key, col1 real, col2 real, ..., coln real)
  2.  
  3. 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;
  4.  
  5. Bitmap Heap Scan on table1 (cost=9.72..17.76 rows=4 width=24) (actual time=28.290..45.165 rows=4 loops=1)
  6. Recheck Cond: ((id = 461) OR (id = 7618) OR (id = 45581) OR (id = 5238))
  7. Heap Blocks: exact=4
  8. -> BitmapOr (cost=9.72..9.72 rows=4 width=0) (actual time=16.748..16.748 rows=0 loops=1)
  9. -> 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)
  10. Index Cond: (id = 461)
  11. -> 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)
  12. Index Cond: (id = 7618)
  13. -> 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)
  14. Index Cond: (id = 45581)
  15. -> 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)
  16. Index Cond: (id = 5238)
  17. Planning time: 0.074 ms
  18. Execution time: 45.197 ms
  19. (14 rows)
  20.  
  21. Bitmap Heap Scan on table1 (cost=9.72..17.76 rows=4 width=24) (actual time=0.031..0.036 rows=4 loops=1)
  22. Recheck Cond: ((id = 461) OR (id = 7618) OR (id = 45581) OR (id = 5238))
  23. Heap Blocks: exact=4
  24. -> BitmapOr (cost=9.72..9.72 rows=4 width=0) (actual time=0.024..0.024 rows=0 loops=1)
  25. -> 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)
  26. Index Cond: (id = 461)
  27. -> 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)
  28. Index Cond: (id = 7618)
  29. -> 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)
  30. Index Cond: (id = 45581)
  31. -> 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)
  32. Index Cond: (id = 5238)
  33. Planning time: 0.078 ms
  34. Execution time: 0.074 ms
  35. (14 rows)
  36.  
  37. EXPLAIN ANALYZE SELECT col1, col12, col22, col17, col41, col27 FROM table1 WHERE table1.id IN(461,7618,45581,5238);
  38.  
  39. EXPLAIN ANALYZE
  40. (SELECT col1, col12, col22, col17, col41, col27 FROM table1 WHERE table1.id=461
  41. UNION
  42. SELECT col1, col12, col22, col17, col41, col27 FROM table1 WHERE table1.id=7618
  43. UNION
  44. SELECT col1, col12, col22, col17, col41, col27 FROM table1 WHERE table1.id=45581
  45. UNION
  46. SELECT col1, col12, col22, col17, col41, col27 FROM table1 table1.id=5238);
Add Comment
Please, Sign In to add comment