| Aggregate (cost=452.22..452.23 rows=1 width=8) |
| -> Sort (cost=426.67..430.93 rows=1703 width=870) |
| Sort Key: p.bargain_date DESC, p.updated_at DESC |
| -> Subquery Scan on p (cost=301.21..335.27 rows=1703 width=870) |
| -> HashAggregate (cost=301.21..318.24 rows=1703 width=842) |
| Group Key: p_1.id, pd.user_id, pd.pct |
| -> Hash Left Join (cost=209.16..288.44 rows=1703 width=60) |
| Hash Cond: (p_1.id = pd.project_id) |
| -> Hash Right Join (cost=206.79..279.67 rows=1703 width=24) |
| Hash Cond: (sc.from_project = p_1.id) |
| -> Seq Scan on tbl_sales_contracts sc (cost=0.00..68.32 rows=1732 width=4) |
| -> Hash (cost=185.50..185.50 rows=1703 width=24) |
| -> Seq Scan on tbl_projects p_1 (cost=0.00..185.50 rows=1703 width=24) |
| Filter: (project_status = 3) |
| -> Hash (cost=2.32..2.32 rows=4 width=40) |
| -> Subquery Scan on pd (cost=2.23..2.32 rows=4 width=40) |
| -> HashAggregate (cost=2.23..2.28 rows=4 width=40) |
| Group Key: t.project_id, r.user_id |
| -> Hash Right Join (cost=1.07..2.20 rows=4 width=13) |
| Hash Cond: (r.erp_profit_distribute_id = t.id) |
| -> Seq Scan on tbl_erp_profit_distribute_pcts r (cost=0.00..1.08 rows=8 width=13) |
| -> Hash (cost=1.05..1.05 rows=2 width=8) |
| -> Seq Scan on tbl_erp_profit_distributes t (cost=0.00..1.05 rows=2 width=8) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |