QUERY PLAN
Aggregate (cost=308.75..308.76 rows=1 width=40)
-> Hash Semi Join (cost=183.88..308.38 rows=73 width=10)
Hash Cond: (tbl_purchase_contracts.id = pc.id)
-> Seq Scan on tbl_purchase_contracts (cost=0.00..117.72 rows=2272 width=10)
-> Hash (cost=182.97..182.97 rows=73 width=4)
-> Hash Anti Join (cost=162.01..182.97 rows=73 width=4)
Hash Cond: (pc.id = pcp.purchase_contract_id)
-> Hash Right Join (cost=135.76..155.61 rows=80 width=4)
Hash Cond: (pcp1.purchase_contract_id = pc.id)
-> Seq Scan on tbl_purchase_contract_contact_points pcp1 (cost=0.00..17.80 rows=780 width=8)
-> Hash (cost=134.76..134.76 rows=80 width=4)
-> Seq Scan on tbl_purchase_contracts pc (cost=0.00..134.76 rows=80 width=4)
Filter: ((NOT is_draft) AND (NOT is_verify) AND (signed_at >= '2026-01-01'::date) AND (signed_at <= '2026-12-31'::date) AND (cost_type = 1))
-> Hash (cost=23.75..23.75 rows=200 width=4)
-> HashAggregate (cost=19.75..21.75 rows=200 width=4)
Group Key: pcp.purchase_contract_id
-> Seq Scan on tbl_purchase_contract_contact_points pcp (cost=0.00..17.80 rows=780 width=4)