1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
explain analyze SELECT * FROM B, A WHERE A.id=B.id AND A.id =110 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =106 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =109 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =105 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =108 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =104 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =111 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =112 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =113 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =114 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =115 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =116 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =117 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =118 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =119 UNION
SELECT * FROM B, A WHERE A.id=B.id AND A.id =120;
=>
"Unique (cost=12118253.70..12498149.10 rows=10130544 width=127) (actual time=53045.073..76026.855 rows=3792894 loops=1)"
" -> Sort (cost=12118253.70..12143580.06 rows=10130544 width=127) (actual time=53045.068..61569.970 rows=3792894 loops=1)"
" Sort Key: id, trade_date, price, size, trade_type, id, full_name, name, bloomberg_id, exchange, currency, "type", country, last_intraday_trading_date"
" -> Append (cost=14668.05..9554412.05 rows=10130544 width=127) (actual time=209.719..29140.871 rows=3792894 loops=1)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=209.715..1854.533 rows=381676 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=11.881..11.886 rows=1 loops=1)"
" Index Cond: (id = 110)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=197.821..765.388 rows=381676 loops=1)"
" Recheck Cond: (110 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=196.920..196.920 rows=381676 loops=1)"
" Index Cond: (110 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=136.273..1306.497 rows=269992 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.019..0.024 rows=1 loops=1)"
" Index Cond: (id = 106)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=136.234..544.500 rows=269992 loops=1)"
" Recheck Cond: (106 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=135.629..135.629 rows=269992 loops=1)"
" Index Cond: (106 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=155.711..1587.212 rows=332342 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.019..0.024 rows=1 loops=1)"
" Index Cond: (id = 109)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=155.674..648.843 rows=332342 loops=1)"
" Recheck Cond: (109 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=154.922..154.922 rows=332342 loops=1)"
" Index Cond: (109 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=139.376..1352.241 rows=271366 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.019..0.023 rows=1 loops=1)"
" Index Cond: (id = 105)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=139.338..585.931 rows=271366 loops=1)"
" Recheck Cond: (105 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=132.109..132.109 rows=271366 loops=1)"
" Index Cond: (105 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=150.368..1778.474 rows=365374 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.020..0.026 rows=1 loops=1)"
" Index Cond: (id = 108)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=150.331..746.200 rows=365374 loops=1)"
" Recheck Cond: (108 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=147.706..147.706 rows=365374 loops=1)"
" Index Cond: (108 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=207.864..1454.164 rows=279586 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=6.012..6.017 rows=1 loops=1)"
" Index Cond: (id = 104)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=201.835..658.534 rows=279586 loops=1)"
" Recheck Cond: (104 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=199.319..199.319 rows=279586 loops=1)"
" Index Cond: (104 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=102.347..1512.403 rows=317148 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.020..0.025 rows=1 loops=1)"
" Index Cond: (id = 111)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=102.309..616.135 rows=317148 loops=1)"
" Recheck Cond: (111 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=101.583..101.583 rows=317148 loops=1)"
" Index Cond: (111 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=7.738..98.341 rows=20298 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.020..0.025 rows=1 loops=1)"
" Index Cond: (id = 112)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=7.702..40.674 rows=20298 loops=1)"
" Recheck Cond: (112 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=7.654..7.654 rows=20298 loops=1)"
" Index Cond: (112 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=224.180..2502.560 rows=506542 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.018..0.023 rows=1 loops=1)"
" Index Cond: (id = 113)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=224.144..1059.475 rows=506542 loops=1)"
" Recheck Cond: (113 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=222.966..222.966 rows=506542 loops=1)"
" Index Cond: (113 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=13.373..135.232 rows=27301 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.020..0.025 rows=1 loops=1)"
" Index Cond: (id = 114)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=13.338..57.950 rows=27301 loops=1)"
" Recheck Cond: (114 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=13.270..13.270 rows=27301 loops=1)"
" Index Cond: (114 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=17.901..115.171 rows=21835 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.019..0.024 rows=1 loops=1)"
" Index Cond: (id = 115)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=17.865..53.596 rows=21835 loops=1)"
" Recheck Cond: (115 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=17.820..17.820 rows=21835 loops=1)"
" Index Cond: (115 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=104.532..1225.125 rows=249396 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.019..0.024 rows=1 loops=1)"
" Index Cond: (id = 116)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=104.496..521.122 rows=249396 loops=1)"
" Recheck Cond: (116 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=103.916..103.916 rows=249396 loops=1)"
" Index Cond: (116 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=170.937..2201.755 rows=462972 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.020..0.025 rows=1 loops=1)"
" Index Cond: (id = 117)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=170.899..895.831 rows=462972 loops=1)"
" Recheck Cond: (117 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=169.822..169.822 rows=462972 loops=1)"
" Index Cond: (117 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=11.872..114.330 rows=23342 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.020..0.025 rows=1 loops=1)"
" Index Cond: (id = 118)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=11.837..48.134 rows=23342 loops=1)"
" Recheck Cond: (118 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=11.786..11.786 rows=23342 loops=1)"
" Index Cond: (118 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=93.905..1152.346 rows=241245 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=7.603..7.609 rows=1 loops=1)"
" Index Cond: (id = 119)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=86.286..463.921 rows=241245 loops=1)"
" Recheck Cond: (119 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=85.766..85.766 rows=241245 loops=1)"
" Index Cond: (119 = id)"
" -> Nested Loop (cost=14668.05..590819.16 rows=633159 width=127) (actual time=11.806..110.855 rows=22479 loops=1)"
" -> Index Scan using A_pkey on A (cost=0.00..8.27 rows=1 width=90) (actual time=0.022..0.028 rows=1 loops=1)"
" Index Cond: (id = 120)"
" -> Bitmap Heap Scan on B (cost=14668.05..584479.31 rows=633159 width=37) (actual time=11.766..47.290 rows=22479 loops=1)"
" Recheck Cond: (120 = id)"
" -> Bitmap Index Scan on id_trade_idx (cost=0.00..14509.76 rows=633159 width=0) (actual time=7.677..7.677 rows=22479 loops=1)"
" Index Cond: (120 = id)"
"Total runtime: 81346.953 ms" |
Partager