QUERY PLAN
Group (cost=56.67..56.68 rows=3 width=4)
Group Key: ip.purchase_invoice_id
-> Sort (cost=56.67..56.68 rows=3 width=4)
Sort Key: ip.purchase_invoice_id
-> Nested Loop (cost=0.28..56.64 rows=3 width=4)
-> Seq Scan on tbl_inventory_product_spents ips (cost=0.00..31.75 rows=3 width=4)
Filter: (sales_invoice_id = 2116)
-> Index Scan using tbl_inventory_products_pkey on tbl_inventory_products ip (cost=0.28..8.29 rows=1 width=8)
Index Cond: (id = ips.inventory_product_id)