QUERY PLAN
GroupAggregate (cost=463.06..464.24 rows=24 width=214)
Group Key: ci.id
-> Sort (cost=463.06..463.19 rows=55 width=160)
Sort Key: ci.id
-> Hash Right Join (cost=166.93..461.47 rows=55 width=160)
Hash Cond: (c.client_industry = ci.id)
-> Hash Join (cost=165.39..459.76 rows=55 width=14)
Hash Cond: (p.used_client = c.id)
-> Bitmap Heap Scan on tbl_projects p (cost=35.49..329.72 rows=55 width=14)
Recheck Cond: (created_by = ANY ('{1004,1005,1013,5087}'::integer[]))
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..35.48 rows=849 width=0)
Index Cond: (created_by = ANY ('{1004,1005,1013,5087}'::integer[]))
-> Hash (cost=105.51..105.51 rows=1951 width=8)
-> Seq Scan on tbl_clients c (cost=0.00..105.51 rows=1951 width=8)
-> Hash (cost=1.24..1.24 rows=24 width=150)
-> Seq Scan on tbl_client_industries ci (cost=0.00..1.24 rows=24 width=150)