QUERY PLAN
GroupAggregate (cost=20.85..20.92 rows=2 width=318)
Group Key: pt.product_type_id, pt.name
-> Sort (cost=20.85..20.86 rows=2 width=318)
Sort Key: pt.product_type_id, pt.name
-> Hash Join (cost=8.18..20.84 rows=2 width=318)
Hash Cond: (pt.project_id = tbl_projects.id)
-> Seq Scan on tbl_project_product_types pt (cost=0.00..12.10 rows=210 width=322)
-> Hash (cost=8.17..8.17 rows=1 width=4)
-> Index Scan using tbl_projects_created_by_idx on tbl_projects (cost=0.14..8.17 rows=1 width=4)
Index Cond: (created_by = 5495)
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))