QUERY PLAN
Limit (cost=0.07..43.77 rows=1 width=509)
-> Result (cost=0.07..43.77 rows=1 width=509)
-> Sort (cost=0.07..0.07 rows=1 width=477)
Sort Key: created_at DESC
-> HashAggregate (cost=0.00..0.06 rows=1 width=477)
Group Key: id
-> Result (cost=0.00..0.00 rows=0 width=365)
One-Time Filter: false
SubPlan 1
-> Aggregate (cost=43.63..43.64 rows=1 width=32)
-> Seq Scan on tbl_invoices i (cost=0.00..43.62 rows=1 width=6)
Filter: (project_id = id)