QUERY PLAN
GroupAggregate (cost=220.37..220.77 rows=6 width=214)
Group Key: ct.id
-> Merge Left Join (cost=220.37..220.55 rows=10 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=219.24..219.26 rows=10 width=14)
Sort Key: c.client_type
-> Nested Loop (cost=5.40..219.07 rows=10 width=14)
-> Bitmap Heap Scan on tbl_projects p (cost=5.12..148.11 rows=10 width=14)
Recheck Cond: (created_by = 1001)
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..5.12 rows=112 width=0)
Index Cond: (created_by = 1001)
-> Index Scan using tbl_clients_pkey on tbl_clients c (cost=0.28..7.09 rows=1 width=8)
Index Cond: (id = p.client_id)