QUERY PLAN
GroupAggregate (cost=190.33..190.59 rows=6 width=214)
Group Key: ct.id
-> Merge Left Join (cost=190.33..190.42 rows=6 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=189.20..189.21 rows=4 width=14)
Sort Key: c.client_type
-> Nested Loop (cost=5.55..189.16 rows=4 width=14)
-> Bitmap Heap Scan on tbl_projects p (cost=5.27..155.97 rows=4 width=14)
Recheck Cond: (created_by = 1001)
Filter: ((bargain_date >= '2026-01-01'::date) AND (bargain_date <= '2026-12-31'::date) AND (bargain_date >= '2026-01-01'::date) AND (bargain_date < '2027-01-01 00:00:00'::timestamp without time zone))
-> Bitmap Index Scan on tbl_projects_created_by_idx (cost=0.00..5.27 rows=132 width=0)
Index Cond: (created_by = 1001)
-> Index Scan using tbl_clients_pkey on tbl_clients c (cost=0.28..8.29 rows=1 width=8)
Index Cond: (id = p.used_client)