Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QUERY PLAN
- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Hash Full Join (cost=120086.28..288158.58 rows=1433 width=247) (actual time=4793.409..4918.029 rows=5919 loops=1)
- Hash Cond: (cld.product_custom_identificator = collected.pci)
- Filter: ((COALESCE((sum(cld.count)), 0::real) <> 0::double precision) OR (COALESCE(collected.total, 0::numeric) <> 0::numeric))
- Rows Removed by Filter: 2
- -> HashAggregate (cost=23731.30..23745.64 rows=1434 width=15) (actual time=10.342..15.889 rows=5664 loops=1)
- InitPlan 25 (returns $39)
- -> Index Scan using uniq_t_currentlevel_stocktakingid_storeid on t_currentlevel cl (cost=0.27..8.29 rows=1 width=8) (actual time=0.054..0.055 rows=1 loops=1)
- Index Cond: (stocktaking_id = 'TeKarvinaKosmo07092014;87'::text)
- -> Bitmap Heap Scan on t_currentlevel_data cld (cost=913.72..23435.31 rows=38360 width=15) (actual time=0.937..3.907 rows=5664 loops=1)
- Recheck Cond: (batch_id = $39)
- -> Bitmap Index Scan on ind_currentleveldata_batchid_pci (cost=0.00..904.13 rows=38360 width=0) (actual time=0.919..0.919 rows=5664 loops=1)
- Index Cond: (batch_id = $39)
- -> Hash (cost=96354.86..96354.86 rows=10 width=232) (actual time=4783.010..4783.010 rows=5618 loops=1)
- Buckets: 1024 Batches: 1 Memory Usage: 811kB
- -> Subquery Scan on collected (cost=96354.73..96354.86 rows=10 width=232) (actual time=4770.172..4777.599 rows=5618 loops=1)
- -> Sort (cost=96354.73..96354.76 rows=10 width=129) (actual time=4770.168..4772.310 rows=5618 loops=1)
- Sort Key: ((SubPlan 17))
- Sort Method: quicksort Memory: 1690kB
- InitPlan 23 (returns $33)
- -> Index Scan using t_store_info_pkey on t_store_info s_9 (cost=0.28..8.29 rows=1 width=8) (actual time=0.007..0.008 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> GroupAggregate (cost=95479.18..96346.27 rows=10 width=129) (actual time=2328.774..4757.026 rows=5618 loops=1)
- -> Sort (cost=95479.18..95479.20 rows=10 width=129) (actual time=2328.346..2335.394 rows=9246 loops=1)
- Sort Key: w.stocktaking_id, ((SubPlan 22))
- Sort Method: quicksort Memory: 2576kB
- -> Nested Loop (cost=313.42..95479.01 rows=10 width=129) (actual time=3.151..1814.618 rows=9246 loops=1)
- -> Bitmap Heap Scan on t_weighting w (cost=312.99..94922.43 rows=46 width=77) (actual time=3.074..1387.025 rows=9246 loops=1)
- Recheck Cond: ((stocktaking_id)::text = 'TeKarvinaKosmo07092014;87'::text)
- Filter: ((user_id)::text = ((SubPlan 24))::text)
- -> Bitmap Index Scan on idx_t_weighting_stocktaking_id_user_id (cost=0.00..312.98 rows=9141 width=0) (actual time=2.566..2.566 rows=9246 loops=1)
- Index Cond: ((stocktaking_id)::text = 'TeKarvinaKosmo07092014;87'::text)
- SubPlan 24
- -> Limit (cost=8.46..8.46 rows=1 width=16) (actual time=0.145..0.146 rows=1 loops=9246)
- -> Sort (cost=8.46..8.46 rows=1 width=16) (actual time=0.144..0.144 rows=1 loops=9246)
- Sort Key: wi.stat_item_start
- Sort Method: top-N heapsort Memory: 25kB
- -> Index Scan using int_t_weighting_coordinates on t_weighting wi (cost=0.42..8.45 rows=1 width=16) (actual time=0.025..0.104 rows=46 loops=9246)
- Index Cond: ((coord_z = w.coord_z) AND (coord_x = w.coord_x) AND (coord_y = w.coord_y))
- Filter: ((stocktaking_id)::text = (w.stocktaking_id)::text)
- Rows Removed by Filter: 34
- -> Index Scan using t_item_ean_company_fk_uniq on t_item i (cost=0.43..8.45 rows=1 width=52) (actual time=0.019..0.020 rows=1 loops=9246)
- Index Cond: ((ean = w.item_ean) AND (company_fk = $33))
- SubPlan 22
- -> Limit (cost=8.72..16.74 rows=1 width=11) (actual time=0.020..0.020 rows=1 loops=9246)
- InitPlan 21 (returns $31)
- -> Index Scan using t_store_info_pkey on t_store_info s_8 (cost=0.28..8.29 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> Index Scan using inx_pn_companyfk_ean on t_pn pn_1 (cost=0.43..8.45 rows=1 width=11) (actual time=0.018..0.018 rows=1 loops=9246)
- Index Cond: ((company_fk = $31) AND (i.ean = ean))
- SubPlan 17
- -> Limit (cost=9.15..9.31 rows=1 width=11) (actual time=0.278..0.278 rows=1 loops=5618)
- InitPlan 16 (returns $19)
- -> Index Scan using t_store_info_pkey on t_store_info s_7 (cost=0.28..8.29 rows=1 width=8) (actual time=0.013..0.014 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> Nested Loop (cost=0.85..102881.78 rows=624667 width=11) (actual time=0.276..0.276 rows=1 loops=5618)
- -> Index Only Scan using int_t_weighting_coordinates on t_weighting w4 (cost=0.42..95064.99 rows=624667 width=0) (actual time=0.013..0.122 rows=112 loops=5618)
- Heap Fetches: 630284
- -> Materialize (cost=0.43..8.45 rows=1 width=11) (actual time=0.001..0.001 rows=0 loops=630284)
- -> Index Scan using inx_pn_companyfk_ean on t_pn pn (cost=0.43..8.45 rows=1 width=11) (actual time=0.020..0.020 rows=1 loops=5618)
- Index Cond: ((company_fk = $19) AND (max(w.item_ean) = ean))
- SubPlan 18
- -> Result (cost=0.00..0.02 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=5618)
- SubPlan 19
- -> Result (cost=0.00..0.02 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=9246)
- SubPlan 20
- -> Aggregate (cost=60.55..60.56 rows=1 width=52) (actual time=0.105..0.105 rows=1 loops=5618)
- -> HashAggregate (cost=60.45..60.47 rows=1 width=27) (actual time=0.091..0.092 rows=1 loops=5618)
- -> Index Scan using idx_t_weighting_stocktaking_id_item_ean on t_weighting w3 (cost=0.43..60.36 rows=4 width=27) (actual time=0.073..0.077 rows=2 loops=5618)
- Index Cond: (((stocktaking_id)::text = (w.stocktaking_id)::text) AND (item_ean = ANY (array_agg(w.item_ean))))
- SubPlan 5
- -> Result (cost=33.50..33.51 rows=1 width=0) (actual time=0.075..0.076 rows=1 loops=303)
- InitPlan 4 (returns $5)
- -> Limit (cost=8.72..33.50 rows=1 width=13) (actual time=0.072..0.073 rows=1 loops=303)
- InitPlan 3 (returns $2)
- -> Index Scan using t_store_info_pkey on t_store_info s_1 (cost=0.28..8.29 rows=1 width=8) (actual time=0.017..0.018 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> Index Scan using inx_pn_companyfk_pci on t_pn pe (cost=0.43..25.21 rows=1 width=13) (actual time=0.070..0.070 rows=1 loops=303)
- Index Cond: ((company_fk = $2) AND (product_custom_identificator = COALESCE(cld.product_custom_identificator, collected.pci)))
- SubPlan 2
- -> Limit (cost=16.75..16.76 rows=1 width=4) (actual time=0.039..0.040 rows=1 loops=303)
- InitPlan 1 (returns $0)
- -> Index Scan using t_store_info_pkey on t_store_info s (cost=0.28..8.29 rows=1 width=8) (actual time=0.003..0.004 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> Aggregate (cost=8.46..8.46 rows=1 width=4) (actual time=0.037..0.037 rows=1 loops=303)
- -> Index Scan using t_item_ean_company_fk_uniq on t_item iu (cost=0.43..8.45 rows=1 width=4) (actual time=0.023..0.025 rows=1 loops=303)
- Index Cond: ((pe.ean = ean) AND (company_fk = $0))
- SubPlan 7
- -> Aggregate (cost=16.75..16.76 rows=1 width=13) (actual time=0.037..0.037 rows=1 loops=303)
- InitPlan 6 (returns $6)
- -> Index Scan using t_store_info_pkey on t_store_info s_2 (cost=0.28..8.29 rows=1 width=8) (actual time=0.005..0.006 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> Index Scan using inx_pn_companyfk_pci on t_pn pe_1 (cost=0.43..8.45 rows=1 width=13) (actual time=0.023..0.029 rows=4 loops=303)
- Index Cond: ((company_fk = $6) AND (product_custom_identificator = COALESCE(cld.product_custom_identificator, collected.pci)))
- SubPlan 11
- -> Limit (cost=8.72..33.48 rows=1 width=13) (actual time=0.048..0.048 rows=1 loops=303)
- InitPlan 10 (returns $11)
- -> Index Scan using t_store_info_pkey on t_store_info s_4 (cost=0.28..8.29 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> Index Scan using inx_pn_companyfk_pci on t_pn pd (cost=0.43..25.19 rows=1 width=13) (actual time=0.046..0.046 rows=1 loops=303)
- Index Cond: ((company_fk = $11) AND (product_custom_identificator = COALESCE(cld.product_custom_identificator, collected.pci)))
- SubPlan 9
- -> Limit (cost=8.72..16.74 rows=1 width=27) (actual time=0.022..0.022 rows=1 loops=303)
- InitPlan 8 (returns $9)
- -> Index Scan using t_store_info_pkey on t_store_info s_3 (cost=0.28..8.29 rows=1 width=8) (actual time=0.003..0.004 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> Index Scan using t_item_ean_company_fk_uniq on t_item i_1 (cost=0.43..8.45 rows=1 width=27) (actual time=0.020..0.020 rows=1 loops=303)
- Index Cond: ((ean = pd.ean) AND (company_fk = $9))
- SubPlan 15
- -> Limit (cost=8.72..33.48 rows=1 width=13) (actual time=0.050..0.050 rows=1 loops=305)
- InitPlan 14 (returns $16)
- -> Index Scan using t_store_info_pkey on t_store_info s_6 (cost=0.28..8.29 rows=1 width=8) (actual time=0.005..0.006 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> Index Scan using inx_pn_companyfk_pci on t_pn pe_2 (cost=0.43..25.19 rows=1 width=13) (actual time=0.047..0.047 rows=1 loops=305)
- Index Cond: ((company_fk = $16) AND (product_custom_identificator = COALESCE(cld.product_custom_identificator, collected.pci)))
- SubPlan 13
- -> Limit (cost=8.72..16.74 rows=1 width=8) (actual time=0.022..0.022 rows=1 loops=304)
- InitPlan 12 (returns $14)
- -> Index Scan using t_store_info_pkey on t_store_info s_5 (cost=0.28..8.29 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=1)
- Index Cond: (id = 87::bigint)
- -> Index Scan using t_item_ean_company_fk_uniq on t_item hi (cost=0.43..8.45 rows=1 width=8) (actual time=0.020..0.020 rows=1 loops=304)
- Index Cond: ((pe_2.ean = ean) AND (company_fk = $14))
- Total runtime: 4921.560 ms
- (122 rows)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement