QUERY PLAN
GroupAggregate (cost=235.86..236.02 rows=5 width=53)
Group Key: pt.product_type_id, pt.name
-> Sort (cost=235.86..235.87 rows=5 width=26)
Sort Key: pt.product_type_id, pt.name
-> Hash Join (cost=157.23..235.80 rows=5 width=26)
Hash Cond: (pt.project_id = tbl_projects.id)
-> Seq Scan on tbl_project_product_types pt (cost=0.00..69.09 rows=3609 width=30)
-> Hash (cost=157.18..157.18 rows=4 width=4)
-> Bitmap Heap Scan on tbl_projects (cost=5.28..157.18 rows=4 width=4)
Recheck Cond: (created_by = 1001)
Filter: ((bargain_date >= '2026-01-01'::date) AND (bargain_date < '2027-01-01 00:00:00'::timestamp without time zone) AND (bargain_date >= '2026-01-01'::date) AND (bargain_date <= '2026-12-31'::date))
-> Bitmap Index Scan on tbl_projects_created_by_idx (cost=0.00..5.28 rows=133 width=0)
Index Cond: (created_by = 1001)