QUERY PLAN
Aggregate (cost=4.90..4.91 rows=1 width=8)
-> Sort (cost=4.89..4.89 rows=1 width=357)
Sort Key: r.created_at DESC
-> HashAggregate (cost=4.87..4.88 rows=1 width=357)
Group Key: r.id
-> Hash Right Join (cost=1.43..4.86 rows=4 width=12)
Hash Cond: (eipss.erp_sales_outbound_id = r.id)
-> Seq Scan on tbl_erp_inventory_product_spents eipss (cost=0.00..3.11 rows=111 width=4)
-> Hash (cost=1.42..1.42 rows=1 width=12)
-> Seq Scan on tbl_erp_sales_outbounds r (cost=0.00..1.42 rows=1 width=12)
Filter: ((project_id = 3959) AND (status = 2))