QUERY PLAN
Aggregate (cost=12.16..12.17 rows=1 width=32)
-> Nested Loop Left Join (cost=4.87..12.15 rows=1 width=37)
Join Filter: (esrps.erp_sales_return_id = t.id)
-> Seq Scan on tbl_erp_sales_returns t (cost=0.00..1.01 rows=1 width=4)
Filter: (status = 2)
-> Hash Right Join (cost=4.87..11.13 rows=1 width=41)
Hash Cond: (eipss.erp_sales_outbound_spent_product_id = esosps.id)
-> Seq Scan on tbl_erp_inventory_product_spents eipss (cost=0.00..5.36 rows=236 width=9)
-> Hash (cost=4.86..4.86 rows=1 width=40)
-> Hash Right Join (cost=1.02..4.86 rows=1 width=40)
Hash Cond: (esosps.id = esrps.erp_sales_outbound_spent_product_id)
-> Seq Scan on tbl_erp_sales_outbound_spent_products esosps (cost=0.00..3.33 rows=133 width=4)
-> Hash (cost=1.01..1.01 rows=1 width=40)
-> Seq Scan on tbl_erp_sales_return_products esrps (cost=0.00..1.01 rows=1 width=40)