QUERY PLAN
GroupAggregate (cost=166.37..167.20 rows=24 width=214)
Group Key: ci.id
-> Merge Left Join (cost=166.37..166.54 rows=24 width=160)
Merge Cond: (ci.id = c.client_industry)
-> Sort (cost=1.79..1.85 rows=24 width=150)
Sort Key: ci.id
-> Seq Scan on tbl_client_industries ci (cost=0.00..1.24 rows=24 width=150)
-> Sort (cost=164.58..164.59 rows=3 width=14)
Sort Key: c.client_industry
-> Nested Loop (cost=5.33..164.56 rows=3 width=14)
-> Bitmap Heap Scan on tbl_projects p (cost=5.05..139.67 rows=3 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.05 rows=103 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.client_id)