| Aggregate (cost=287.23..287.24 rows=1 width=8) |
| -> Sort (cost=287.22..287.22 rows=1 width=870) |
| Sort Key: p.bargain_date DESC, p.updated_at DESC |
| -> Subquery Scan on p (cost=287.17..287.21 rows=1 width=870) |
| -> GroupAggregate (cost=287.17..287.20 rows=1 width=842) |
| Group Key: p_1.id, r.user_id, (sum(r.pct)) |
| -> Sort (cost=287.17..287.18 rows=1 width=60) |
| Sort Key: p_1.id, r.user_id, (sum(r.pct)) |
| -> Nested Loop Left Join (cost=214.06..287.16 rows=1 width=60) |
| Join Filter: (t.project_id = p_1.id) |
| -> Hash Right Join (cost=200.00..273.05 rows=1 width=24) |
| Hash Cond: (sc.from_project = p_1.id) |
| -> Seq Scan on tbl_sales_contracts sc (cost=0.00..68.46 rows=1746 width=4) |
| -> Hash (cost=199.99..199.99 rows=1 width=24) |
| -> Seq Scan on tbl_projects p_1 (cost=0.00..199.99 rows=1 width=24) |
| Filter: ((bargain_date >= '2026-12-01'::date) AND (bargain_date <= '2026-12-31'::date) AND (project_status = 3)) |
| -> 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) |