QUERY PLAN
GroupAggregate (cost=34.81..35.66 rows=31 width=84)
Group Key: t.created_at, esosps.id
-> Sort (cost=34.81..34.89 rows=31 width=30)
Sort Key: t.created_at, esosps.id
-> Hash Join (cost=19.81..34.04 rows=31 width=30)
Hash Cond: (esosps.erp_sales_outbound_id = t.id)
-> Hash Right Join (cost=12.06..26.21 rows=33 width=22)
Hash Cond: (eipss.erp_sales_outbound_spent_product_id = esosps.id)
-> Seq Scan on tbl_erp_inventory_product_spents eipss (cost=0.00..12.65 rows=565 width=14)
-> Hash (cost=11.68..11.68 rows=31 width=12)
-> Seq Scan on tbl_erp_sales_outbound_spent_products esosps (cost=0.00..11.68 rows=31 width=12)
Filter: (product_id = 941)
-> Hash (cost=5.92..5.92 rows=146 width=16)
-> Seq Scan on tbl_erp_sales_outbounds t (cost=0.00..5.92 rows=146 width=16)
Filter: (status = 2)