QUERY PLAN
GroupAggregate (cost=403.95..405.97 rows=62 width=53)
Group Key: pt.product_type_id, pt.name
-> Sort (cost=403.95..404.11 rows=62 width=26)
Sort Key: pt.product_type_id, pt.name
-> Hash Join (cost=330.41..402.11 rows=62 width=26)
Hash Cond: (pt.project_id = tbl_projects.id)
-> Seq Scan on tbl_project_product_types pt (cost=0.00..63.02 rows=3302 width=30)
-> Hash (cost=329.72..329.72 rows=55 width=4)
-> Bitmap Heap Scan on tbl_projects (cost=35.49..329.72 rows=55 width=4)
Recheck Cond: (created_by = ANY ('{1004,1005,1013,5087}'::integer[]))
Filter: ((bargain_date >= '2025-01-01'::date) AND (bargain_date < '2026-01-01 00:00:00'::timestamp without time zone) AND (bargain_date >= '2025-01-01'::date) AND (bargain_date <= '2025-12-31'::date))
-> 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[]))