| Aggregate (cost=338.56..338.57 rows=1 width=8) |
| -> Sort (cost=338.30..338.35 rows=17 width=870) |
| Sort Key: p.bargain_date DESC, p.updated_at DESC |
| -> Subquery Scan on p (cost=337.45..337.96 rows=17 width=870) |
| -> GroupAggregate (cost=337.45..337.79 rows=17 width=842) |
| Group Key: p_1.id, pd.user_id, pd.pct |
| -> Sort (cost=337.45..337.49 rows=17 width=60) |
| Sort Key: p_1.id, pd.user_id, pd.pct |
| -> Hash Left Join (cost=216.14..337.10 rows=17 width=60) |
| Hash Cond: (p_1.id = pd.project_id) |
| -> Hash Join (cost=202.03..322.91 rows=17 width=24) |
| Hash Cond: (sc.from_project = p_1.id) |
| -> Seq Scan on tbl_sales_contracts sc (cost=0.00..118.25 rows=1002 width=4) |
| Filter: (NOT is_outbound) |
| -> Hash (cost=201.37..201.37 rows=53 width=24) |
| -> Seq Scan on tbl_projects p_1 (cost=0.00..201.37 rows=53 width=24) |
| Filter: ((bargain_date >= '2026-01-01'::date) AND (bargain_date <= '2026-12-31'::date) AND (project_status = 3)) |
| -> Hash (cost=14.10..14.10 rows=1 width=40) |
| -> Subquery Scan on pd (cost=14.06..14.10 rows=1 width=40) |
| -> GroupAggregate (cost=14.06..14.09 rows=1 width=40) |
| Group Key: t.project_id, r.user_id |
| -> Sort (cost=14.06..14.07 rows=1 width=13) |
| Sort Key: t.project_id, r.user_id |
| -> Nested Loop Left Join (cost=0.00..14.05 rows=1 width=13) |
| Join Filter: (t.id = r.erp_profit_distribute_id) |
| -> 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)) |
| -> Seq Scan on tbl_erp_profit_distribute_pcts r (cost=0.00..1.08 rows=8 width=13) |