| Limit (cost=330.75..330.80 rows=20 width=188) |
| -> Sort (cost=330.75..330.86 rows=42 width=188) |
| Sort Key: p.in_out_at DESC NULLS LAST, p.updated_at DESC |
| -> GroupAggregate (cost=328.33..329.63 rows=42 width=188) |
| Group Key: p.id |
| -> Merge Left Join (cost=328.33..329.00 rows=42 width=188) |
| Merge Cond: (p.id = eip_1.product_id) |
| -> Sort (cost=268.89..268.99 rows=42 width=156) |
| Sort Key: p.id |
| -> Hash Right Join (cost=257.75..267.76 rows=42 width=156) |
| Hash Cond: (esosps.erp_inventory_product_id = eip.id) |
| -> Seq Scan on tbl_erp_sales_outbound_spent_products esosps (cost=0.00..8.11 rows=411 width=8) |
| -> Hash (cost=257.23..257.23 rows=42 width=160) |
| -> Hash Right Join (cost=129.94..257.23 rows=42 width=160) |
| Hash Cond: (sc.from_project = epips.project_id) |
| -> Seq Scan on tbl_sales_contracts sc (cost=0.00..118.25 rows=1725 width=4) |
| -> Hash (cost=129.42..129.42 rows=42 width=164) |
| -> Hash Join (cost=124.34..129.42 rows=42 width=164) |
| Hash Cond: (eip.product_id = p.id) |
| -> Hash Right Join (cost=25.62..30.59 rows=42 width=12) |
| Hash Cond: (epips.erp_purchase_inbound_id = epis.id) |
| -> Seq Scan on tbl_erp_purchase_inbound_projects epips (cost=0.00..3.89 rows=189 width=8) |
| -> Hash (cost=25.09..25.09 rows=42 width=12) |
| -> Hash Left Join (cost=10.77..25.09 rows=42 width=12) |
| Hash Cond: (eip.erp_purchase_inbound_id = epis.id) |
| -> Seq Scan on tbl_erp_inventory_products eip (cost=0.00..14.21 rows=42 width=32) |
| Filter: (inventory > '0'::numeric) |
| -> Hash (cost=8.12..8.12 rows=212 width=4) |
| -> Seq Scan on tbl_erp_purchase_inbounds epis (cost=0.00..8.12 rows=212 width=4) |
| -> Hash (cost=72.21..72.21 rows=2121 width=156) |
| -> Seq Scan on tbl_products p (cost=0.00..72.21 rows=2121 width=156) |
| -> GroupAggregate (cost=59.44..59.72 rows=14 width=68) |
| Group Key: eip_1.product_id |
| -> Sort (cost=59.44..59.48 rows=14 width=8) |
| Sort Key: eip_1.product_id |
| -> Nested Loop Left Join (cost=35.62..59.17 rows=14 width=8) |
| -> Hash Left Join (cost=35.35..53.54 rows=14 width=8) |
| Hash Cond: (eips.erp_inventory_disassemble_spent_id = eid.id) |
| Filter: (((eips.erp_sales_outbound_id IS NOT NULL) AND (esos.status = 1)) OR ((eips.erp_sales_gift_id IS NOT NULL) AND (esg.status = 1)) OR ((eips.erp_inventory_lost_id IS NOT NULL) AND (eil.status = 1)) OR ((eips.erp_inventory_build_spent_id IS NOT NULL) AND (eib.status = 1)) OR ((eips.erp_inventory_disassemble_spent_id IS NOT NULL) AND (eid.status = 1))) |
| -> Hash Left Join (cost=21.30..38.37 rows=428 width=36) |
| Hash Cond: (eips.erp_inventory_build_spent_id = eib.id) |
| -> Hash Left Join (cost=20.26..36.19 rows=428 width=34) |
| Hash Cond: (eips.erp_inventory_lost_id = eil.id) |
| -> Hash Left Join (cost=19.19..33.98 rows=428 width=32) |
| Hash Cond: (eips.erp_sales_gift_id = esg.id) |
| -> Hash Left Join (cost=10.42..24.08 rows=428 width=30) |
| Hash Cond: (eips.erp_sales_outbound_id = esos.id) |
| -> Seq Scan on tbl_erp_inventory_product_spents eips (cost=0.00..12.51 rows=428 width=28) |
| Filter: ((erp_sales_outbound_id IS NOT NULL) OR (erp_sales_gift_id IS NOT NULL) OR (erp_inventory_lost_id IS NOT NULL) OR (erp_inventory_build_spent_id IS NOT NULL) OR (erp_inventory_disassemble_spent_id IS NOT NULL)) |
| -> Hash (cost=8.52..8.52 rows=152 width=6) |
| -> Seq Scan on tbl_erp_sales_outbounds esos (cost=0.00..8.52 rows=152 width=6) |
| -> Hash (cost=7.23..7.23 rows=123 width=6) |
| -> Seq Scan on tbl_erp_sales_gifts esg (cost=0.00..7.23 rows=123 width=6) |
| -> Hash (cost=1.03..1.03 rows=3 width=6) |
| -> Seq Scan on tbl_erp_inventory_losts eil (cost=0.00..1.03 rows=3 width=6) |
| -> Hash (cost=1.02..1.02 rows=2 width=6) |
| -> Seq Scan on tbl_erp_inventory_builds eib (cost=0.00..1.02 rows=2 width=6) |
| -> Hash (cost=11.80..11.80 rows=180 width=6) |
| -> Seq Scan on tbl_erp_inventory_disassembles eid (cost=0.00..11.80 rows=180 width=6) |
| -> Index Scan using tbl_erp_inventory_products_pkey on tbl_erp_inventory_products eip_1 (cost=0.27..0.40 rows=1 width=8) |
| Index Cond: (eips.erp_inventory_product_id = id) |