QUERY PLAN
HashAggregate (cost=203.37..207.40 rows=269 width=97)
Group Key: gs.id
-> Hash Right Join (cost=142.07..200.68 rows=269 width=43)
Hash Cond: (gs.id = prod.product_serie)
-> Seq Scan on tbl_product_series gs (cost=0.00..41.96 rows=1596 width=33)
-> Hash (cost=138.71..138.71 rows=269 width=14)
-> Hash Join (cost=123.83..138.71 rows=269 width=14)
Hash Cond: (sp.product_id = prod.id)
-> Hash Join (cost=25.09..39.26 rows=269 width=14)
Hash Cond: (sp.id = eipss.erp_sales_outbound_spent_product_id)
-> Seq Scan on tbl_erp_sales_outbound_spent_products sp (cost=0.00..10.34 rows=534 width=8)
-> Hash (cost=21.73..21.73 rows=269 width=14)
-> Hash Join (cost=8.04..21.73 rows=269 width=14)
Hash Cond: (eipss.erp_sales_outbound_id = t.id)
-> Seq Scan on tbl_erp_inventory_product_spents eipss (cost=0.00..12.65 rows=384 width=18)
Filter: (erp_sales_outbound_spent_product_id IS NOT NULL)
-> Hash (cost=6.70..6.70 rows=108 width=4)
-> Seq Scan on tbl_erp_sales_outbounds t (cost=0.00..6.70 rows=108 width=4)
Filter: ((created_at >= '2025-07-11 00:00:00+08'::timestamp with time zone) AND (created_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2))
-> Hash (cost=72.22..72.22 rows=2122 width=8)
-> Seq Scan on tbl_products prod (cost=0.00..72.22 rows=2122 width=8)