QUERY PLAN
Limit (cost=87.89..87.94 rows=20 width=155)
-> Sort (cost=87.89..90.27 rows=952 width=155)
Sort Key: sci.created_at DESC NULLS LAST
-> HashAggregate (cost=53.04..62.56 rows=952 width=155)
Group Key: sci.id
-> Seq Scan on tbl_sales_contract_invoices sci (cost=0.00..50.66 rows=952 width=155)
Filter: ((cover_invoice_id IS NULL) AND ((from_date >= '2024-08-01'::date) OR (NOT is_draft)))