Aggregate (cost=289.07..289.08 rows=1 width=8) |
-> Sort (cost=281.16..282.48 rows=527 width=726) |
Sort Key: p.erp_profit_amount DESC NULLS LAST, p.updated_at DESC |
-> Subquery Scan on p (cost=242.85..257.34 rows=527 width=726) |
-> HashAggregate (cost=242.85..252.07 rows=527 width=762) |
Group Key: p_1.id, r.user_id, (sum(r.pct)) |
-> Hash Left Join (cost=219.63..236.26 rows=527 width=120) |
Hash Cond: (p_1.id = o.project_id) |
-> Hash Right Join (cost=216.45..231.70 rows=527 width=56) |
Hash Cond: (t.project_id = p_1.id) |
-> HashAggregate (cost=25.64..33.23 rows=607 width=40) |
Group Key: t.project_id, r.user_id |
-> Hash Right Join (cost=1.20..21.09 rows=607 width=40) |
Hash Cond: (r.erp_profit_distribute_id = t.id) |
-> Seq Scan on tbl_erp_profit_distribute_pcts r (cost=0.00..17.80 rows=780 width=40) |
-> Hash (cost=1.11..1.11 rows=7 width=8) |
-> Seq Scan on tbl_erp_profit_distributes t (cost=0.00..1.11 rows=7 width=8) |
Filter: ((project_id IS NOT NULL) AND (status = 2)) |
-> Hash (cost=184.22..184.22 rows=527 width=20) |
-> Seq Scan on tbl_projects p_1 (cost=0.00..184.22 rows=527 width=20) |
Filter: ((collected < budget) AND (project_status = 3)) |
-> Hash (cost=3.16..3.16 rows=1 width=68) |
-> Subquery Scan on o (cost=3.14..3.16 rows=1 width=68) |
-> HashAggregate (cost=3.14..3.15 rows=1 width=68) |
Group Key: t_1.project_id |
-> Hash Right Join (cost=1.22..3.11 rows=4 width=13) |
Hash Cond: (eipss.erp_sales_outbound_id = t_1.id) |
-> Seq Scan on tbl_erp_inventory_product_spents eipss (cost=0.00..1.68 rows=68 width=13) |
-> Hash (cost=1.21..1.21 rows=1 width=8) |
-> Seq Scan on tbl_erp_sales_outbounds t_1 (cost=0.00..1.21 rows=1 width=8) |
Filter: ((project_id IS NOT NULL) AND (status = 2)) |