| Aggregate (cost=311.01..311.02 rows=1 width=8) |
| -> Sort (cost=308.80..309.17 rows=147 width=854) |
| Sort Key: p.bargain_date DESC, p.updated_at DESC |
| -> Subquery Scan on p (cost=300.57..303.51 rows=147 width=854) |
| -> HashAggregate (cost=300.57..302.04 rows=147 width=826) |
| Group Key: p_1.id, pd.user_id, pd.pct |
| -> Hash Left Join (cost=230.23..299.47 rows=147 width=60) |
| Hash Cond: (p_1.id = pd.project_id) |
| -> Hash Right Join (cost=197.30..265.98 rows=147 width=24) |
| Hash Cond: (sc.from_project = p_1.id) |
| -> Seq Scan on tbl_sales_contracts sc (cost=0.00..64.37 rows=1637 width=4) |
| -> Hash (cost=195.46..195.46 rows=147 width=24) |
| -> Seq Scan on tbl_projects p_1 (cost=0.00..195.46 rows=147 width=24) |
| Filter: ((bargain_date >= '2025-01-01'::date) AND (bargain_date <= '2025-12-31'::date) AND (project_status = 3)) |
| -> Hash (cost=32.89..32.89 rows=3 width=40) |
| -> Subquery Scan on pd (cost=32.79..32.89 rows=3 width=40) |
| -> GroupAggregate (cost=32.79..32.86 rows=3 width=40) |
| Group Key: t.project_id, r.user_id |
| -> Sort (cost=32.79..32.80 rows=3 width=40) |
| Sort Key: t.project_id, r.user_id |
| -> Hash Right Join (cost=12.89..32.77 rows=3 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=12.88..12.88 rows=1 width=8) |
| -> Seq Scan on tbl_erp_profit_distributes t (cost=0.00..12.88 rows=1 width=8) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |