QUERY PLAN
GroupAggregate (cost=194.16..194.39 rows=7 width=117)
Group Key: client.id
-> Sort (cost=194.16..194.18 rows=7 width=59)
Sort Key: client.id
-> Nested Loop Left Join (cost=5.38..194.06 rows=7 width=59)
-> Bitmap Heap Scan on tbl_projects p (cost=5.11..143.99 rows=7 width=18)
Recheck Cond: (created_by = 1001)
Filter: ((bargain_date >= '2024-01-01'::date) AND (bargain_date < '2025-01-01 00:00:00'::timestamp without time zone) AND (project_status = 3))
-> Bitmap Index Scan on tbl_projects_created_by_idx (cost=0.00..5.11 rows=110 width=0)
Index Cond: (created_by = 1001)
-> Index Scan using tbl_clients_pkey on tbl_clients client (cost=0.28..7.15 rows=1 width=45)
Index Cond: (p.client_id = id)