QUERY PLAN
GroupAggregate (cost=48.85..48.89 rows=1 width=117)
Group Key: client.id
-> Sort (cost=48.85..48.85 rows=1 width=63)
Sort Key: client.id
-> Nested Loop Left Join (cost=0.56..48.84 rows=1 width=63)
-> Nested Loop (cost=0.28..45.65 rows=1 width=22)
-> Nested Loop (cost=0.00..37.19 rows=1 width=8)
-> Seq Scan on tbl_users u (cost=0.00..7.76 rows=1 width=4)
Filter: (id = 1001)
-> Seq Scan on tbl_project_architects pa (cost=0.00..29.41 rows=1 width=12)
Filter: (engineer_id = 1001)
-> Index Scan using tbl_projects_pkey on tbl_projects p (cost=0.28..8.30 rows=1 width=18)
Index Cond: (id = pa.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))
-> Index Scan using tbl_clients_pkey on tbl_clients client (cost=0.28..3.19 rows=1 width=45)
Index Cond: (p.client_id = id)