QUERY PLAN
Aggregate (cost=82.95..82.96 rows=1 width=8)
-> HashAggregate (cost=42.90..60.70 rows=1780 width=330)
Group Key: sci.id
-> Seq Scan on tbl_sales_contract_invoices sci (cost=0.00..38.45 rows=1780 width=4)
Filter: (cover_invoice_id IS NULL)