QUERY PLAN
GroupAggregate (cost=360.64..361.38 rows=6 width=214)
Group Key: ct.id
-> Sort (cost=360.64..360.75 rows=43 width=160)
Sort Key: ct.id
-> Hash Right Join (cost=129.50..359.47 rows=43 width=160)
Hash Cond: (c.client_type = ct.id)
-> Hash Join (cost=128.37..358.15 rows=43 width=14)
Hash Cond: (p.used_client = c.id)
-> Seq Scan on tbl_projects p (cost=0.00..229.67 rows=43 width=14)
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) AND (created_by = ANY ('{1001,1004,1005,1013,5087,5295,5300,5311,5329,5332,5420}'::integer[])))
-> Hash (cost=104.83..104.83 rows=1883 width=8)
-> Seq Scan on tbl_clients c (cost=0.00..104.83 rows=1883 width=8)
-> Hash (cost=1.06..1.06 rows=6 width=150)
-> Seq Scan on tbl_client_types ct (cost=0.00..1.06 rows=6 width=150)