QUERY PLAN
Aggregate (cost=51.87..51.88 rows=1 width=72)
-> Nested Loop (cost=43.63..51.85 rows=1 width=46)
-> GroupAggregate (cost=43.35..43.38 rows=1 width=36)
Group Key: pas.project_id
Filter: (sum(pas.contribution) IS NOT NULL)
-> Sort (cost=43.35..43.36 rows=1 width=8)
Sort Key: pas.project_id
-> Seq Scan on tbl_project_architects pas (cost=0.00..43.34 rows=1 width=8)
Filter: ((engineer_id = 1001) AND (engineer_id = ANY ('{1017,5085,1001,5248,1015,1022,5296,1023}'::integer[])))
-> Index Scan using tbl_projects_pkey on tbl_projects p (cost=0.28..8.30 rows=1 width=14)
Index Cond: (id = pas.project_id)
Filter: ((bargain_date >= '2025-01-01'::date) AND (bargain_date < '2026-01-01 00:00:00'::timestamp without time zone) AND (project_status = 3))