QUERY PLAN
GroupAggregate (cost=295.15..295.49 rows=6 width=214)
Group Key: ct.id
-> Merge Left Join (cost=295.15..295.30 rows=8 width=160)
Merge Cond: (ct.id = c.client_type)
-> Sort (cost=1.14..1.15 rows=6 width=150)
Sort Key: ct.id
-> Seq Scan on tbl_client_types ct (cost=0.00..1.06 rows=6 width=150)
-> Sort (cost=294.01..294.03 rows=8 width=14)
Sort Key: c.client_type
-> Nested Loop (cost=9.51..293.89 rows=8 width=14)
-> Bitmap Heap Scan on tbl_projects p (cost=9.23..235.52 rows=8 width=14)
Recheck Cond: (created_by = 5087)
Filter: ((bargain_date >= '2025-01-01'::date) AND (bargain_date <= '2025-12-31'::date) AND (bargain_date >= '2025-01-01'::date) AND (bargain_date < '2026-01-01 00:00:00'::timestamp without time zone))
-> Bitmap Index Scan on tbl_projects_created_by_idx (cost=0.00..9.23 rows=127 width=0)
Index Cond: (created_by = 5087)
-> Index Scan using tbl_clients_pkey on tbl_clients c (cost=0.28..7.29 rows=1 width=8)
Index Cond: (id = p.used_client)