@anonimowy @Dregorio
Zapytanie wolne:
Hash Join (cost=2.26..7408029.29 rows=29604258 width=146) (actual time=30748.790..41914.833 rows=19 loops=1)
Hash Cond: (o.book_id = b.id)
-> Append (cost=0.00..6901582.75 rows=183969317 width=146) (actual time=0.025..28696.397 rows=183874198 loops=1)
-> Seq Scan on order_2022_08 wl_1 (cost=0.00..1.33 rows=33 width=150) (actual time=0.023..0.026 rows=33 loops=1)
-> Seq Scan on order_2022_09 wl_2 (cost=0.00..11.00 rows=100 width=732) (actual time=0.007..0.007 rows=0 loops=1)
-> Seq Scan on order_2022_10 wl_3 (cost=0.00..77.39 rows=2539 width=129) (actual time=0.021..0.500 rows=2539 loops=1)
-> Seq Scan on order_2022_11 wl_4 (cost=0.00..11.00 rows=100 width=732) (actual time=0.002..0.002 rows=0 loops=1)
-> Seq Scan on order_2022_12 wl_5 (cost=0.00..11.00 rows=100 width=732) (actual time=0.003..0.003 rows=0 loops=1)
-> Seq Scan on order_2023_01 wl_6 (cost=0.00..11.00 rows=100 width=732) (actual time=0.002..0.002 rows=0 loops=1)
-> Seq Scan on order_2023_02 wl_7 (cost=0.00..11.00 rows=100 width=732) (actual time=0.002..0.002 rows=0 loops=1)
-> Seq Scan on order_2023_03 wl_8 (cost=0.00..11.00 rows=100 width=732) (actual time=0.003..0.003 rows=0 loops=1)
-> Seq Scan on order_2023_04 wl_9 (cost=0.00..11.00 rows=100 width=732) (actual time=0.002..0.002 rows=0 loops=1)
-> Seq Scan on order_2023_05 wl_10 (cost=0.00..28481.43 rows=911143 width=136) (actual time=0.012..128.545 rows=911143 loops=1)
-> Seq Scan on order_2023_06 wl_11 (cost=0.00..85697.79 rows=2741479 width=136) (actual time=0.015..370.163 rows=2741483 loops=1)
-> Seq Scan on order_2023_07 wl_12 (cost=0.00..95413.89 rows=3052689 width=136) (actual time=0.015..406.853 rows=3052669 loops=1)
-> Seq Scan on order_2023_08 wl_13 (cost=0.00..134309.17 rows=4434017 width=128) (actual time=0.017..584.706 rows=4435031 loops=1)
-> Seq Scan on order_default wl_14 (cost=0.00..5637678.17 rows=172826717 width=147) (actual time=0.020..17390.829 rows=172731300 loops=1)
-> Hash (cost=2.09..2.09 rows=14 width=4) (actual time=92.141..92.143 rows=14 loops=1)
Buckets: 1024 Batches: 1 Memory Usage: 9kB
-> Seq Scan on book b (cost=0.00..2.09 rows=14 width=4) (actual time=92.125..92.131 rows=14 loops=1)
Filter: (genre_id = 4)
Rows Removed by Filter: 73
Planning Time: 1.643 ms
JIT:
Functions: 9
Options: Inlining true, Optimization true, Expressions true, Deforming true
Timing: Generation 2.346 ms, Inlining 5.435 ms, Optimization 55.504 ms, Emission 30.951 ms, Total 94.234 ms
Execution Time: 41917.352 ms
Zapytanie szybkie:
Append (cost=0.00..506781.30 rows=144186 width=145) (actual time=308.350..308.519 rows=19 loops=1)
-> Seq Scan on order_2022_08 wl_1 (cost=0.00..1.91 rows=1 width=150) (actual time=307.914..307.914 rows=0 loops=1)
Filter: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
Rows Removed by Filter: 33
-> Seq Scan on order_2022_09 wl_2 (cost=0.00..12.75 rows=14 width=732) (actual time=0.010..0.010 rows=0 loops=1)
Filter: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Index Scan using order_2022_10_book_id_order_s_idx on order_2022_10 wl_3 (cost=0.28..77.78 rows=14 width=129) (actual time=0.104..0.104 rows=0 loops=1)
Index Cond: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Seq Scan on order_2022_11 wl_4 (cost=0.00..12.75 rows=14 width=732) (actual time=0.002..0.002 rows=0 loops=1)
Filter: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Seq Scan on order_2022_12 wl_5 (cost=0.00..12.75 rows=14 width=732) (actual time=0.003..0.003 rows=0 loops=1)
Filter: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Seq Scan on order_2023_01 wl_6 (cost=0.00..12.75 rows=14 width=732) (actual time=0.003..0.003 rows=0 loops=1)
Filter: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Seq Scan on order_2023_02 wl_7 (cost=0.00..12.75 rows=14 width=732) (actual time=0.002..0.003 rows=0 loops=1)
Filter: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Seq Scan on order_2023_03 wl_8 (cost=0.00..12.75 rows=14 width=732) (actual time=0.003..0.003 rows=0 loops=1)
Filter: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Seq Scan on order_2023_04 wl_9 (cost=0.00..12.75 rows=14 width=732) (actual time=0.003..0.003 rows=0 loops=1)
Filter: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Index Scan using order_2023_05_book_id_order_s_idx on order_2023_05 wl_10 (cost=0.42..3404.15 rows=1323 width=136) (actual time=0.059..0.060 rows=0 loops=1)
Index Cond: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Index Scan using order_2023_06_book_id_order_s_idx on order_2023_06 wl_11 (cost=0.43..6679.33 rows=2399 width=136) (actual time=0.059..0.060 rows=0 loops=1)
Index Cond: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Index Scan using order_2023_07_book_id_order_s_idx on order_2023_07 wl_12 (cost=0.43..21660.29 rows=8141 width=136) (actual time=0.055..0.056 rows=0 loops=1)
Index Cond: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Bitmap Heap Scan on order_2023_08 wl_13 (cost=317.07..32044.41 rows=11233 width=128) (actual time=0.054..0.054 rows=0 loops=1)
Recheck Cond: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Bitmap Index Scan on order_2023_08_book_id_order_s_idx (cost=0.00..314.26 rows=11233 width=0) (actual time=0.051..0.052 rows=0 loops=1)
Index Cond: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
-> Index Scan using order_default_book_id_order_s_idx on order_default wl_14 (cost=0.57..442103.26 rows=120977 width=147) (actual time=0.068..0.230 rows=19 loops=1)
Index Cond: (book_id = ANY ('{12, 15, 22, 34, 77, 99, 127, 212, 515, 896}'::integer[]))
Planning Time: 1.260 ms
JIT:
Functions: 28
Options: Inlining true, Optimization true, Expressions true, Deforming true
Timing: Generation 6.408 ms, Inlining 3.418 ms, Optimization 188.866 ms, Emission 115.242 ms, Total 313.934 ms
Execution Time: 315.176 ms