-- Index for position_consumed CTE: joins lots on (chain_id, user, group, obligation_id) skipping contract.
-- PK (chain_id, user, contract, group, obligation_id) has contract between user and group, preventing efficient group filtering.
CREATE INDEX "lots_position_group_obligation_idx" ON "router_v1.14"."lots" USING btree ("chain_id","user","group","obligation_id");--> statement-breakpoint
-- Index for position_offsets CTE: filters offsets on (chain_id, contract, user) but PK order is (chain_id, user, contract, ...).
CREATE INDEX "offsets_position_obligation_idx" ON "router_v1.14"."offsets" USING btree ("chain_id","contract","user","obligation_id");
