QUERY PLAN
Limit (cost=67.39..67.44 rows=20 width=155)
-> Sort (cost=67.39..68.94 rows=622 width=155)
Sort Key: sci.from_date DESC NULLS LAST, sci.created_at DESC NULLS LAST
-> HashAggregate (cost=44.62..50.84 rows=622 width=155)
Group Key: sci.id
-> Seq Scan on tbl_sales_contract_invoices sci (cost=0.00..43.06 rows=622 width=155)
Filter: ((cover_invoice_id IS NULL) AND ((from_date >= '2024-08-01'::date) OR (NOT is_draft)))