QUERY PLAN
Subquery Scan on sub (cost=2.78..3.71 rows=1 width=326)
Filter: (sub.id = 26)
-> WindowAgg (cost=2.78..3.32 rows=31 width=326)
-> Sort (cost=2.78..2.85 rows=31 width=318)
Sort Key: sub_1.created_at DESC
-> Subquery Scan on sub_1 (cost=1.39..2.01 rows=31 width=318)
-> HashAggregate (cost=1.39..1.70 rows=31 width=318)
Group Key: r.id
-> Seq Scan on tbl_erp_inventory_starts r (cost=0.00..1.31 rows=31 width=318)