QUERY PLAN
Limit (cost=3.23..3.24 rows=1 width=357)
-> Sort (cost=3.23..3.24 rows=1 width=357)
Sort Key: r.created_at DESC
-> HashAggregate (cost=3.20..3.22 rows=1 width=357)
Group Key: r.id
-> Hash Right Join (cost=1.27..3.15 rows=4 width=217)
Hash Cond: (eipss.erp_sales_outbound_id = r.id)
-> Seq Scan on tbl_erp_inventory_product_spents eipss (cost=0.00..1.68 rows=68 width=13)
-> Hash (cost=1.25..1.25 rows=1 width=208)
-> Seq Scan on tbl_erp_sales_outbounds r (cost=0.00..1.25 rows=1 width=208)
Filter: ((project_id = 3959) AND (status = 2))