Reads filtering stage.Users by email keep flagging amber — index it, and FROM "stage.Users"."byEmail" WHERE email = … becomes a key-condition Query.
CREATE GLOBAL INDEX "byEmail" ON "stage.Users" PARTITION KEY (email) PROJECT ALL Add or remove a GSI — an alternate key shape over the same table. CREATE GLOBAL INDEX is the standing fix for a read that keeps flagging amber: index the attribute you filter by, and the filter becomes a key condition. DROP GSI removes that read path without deleting any base-table items. Both lower to UpdateTable.
CREATE GLOBAL INDEX "name" ON "table" PARTITION KEY (attr[, attr…]) -- up to 4, types default STRING [SORT KEY (attr[, attr…])] -- up to 4; per-attr type: publishedAt N PROJECT ALL | KEYS | INCLUDE (a, b)-- compatibility aliases: CREATE GSI · CREATE GLOBAL SECONDARY INDEX · CREATE INDEXDROP GSI "name" ON "table";-- aliases: DROP GLOBAL SECONDARY INDEX · DROP INDEX For create, PROJECT chooses what rides along: ALL (every attribute), KEYS (just the keys), or INCLUDE (a, b) (keys plus the named attributes). For drop, DROP GSI is the preferred DynamoDB-specific spelling; DROP GLOBAL SECONDARY INDEX and DROP INDEX are accepted aliases. Guides: Tables, indexes & replicas for the lifecycle, Targeted reads for the multi-key Query rule.
Reads filtering stage.Users by email keep flagging amber — index it, and FROM "stage.Users"."byEmail" WHERE email = … becomes a key-condition Query.
CREATE GLOBAL INDEX "byEmail" ON "stage.Users" PARTITION KEY (email) PROJECT ALL Region + tenant as partition attributes, status + date as sort attributes — kept separate and typed, not mashed into one region#tenant#status string you parse back out.
CREATE GLOBAL INDEX "byRegionStatus" ON "stage.Orders" PARTITION KEY (region, tenant) SORT KEY (status, createdAt) PROJECT ALL An index that answers "list events by delivery status" doesn't need the whole item — INCLUDE keeps the index lean and its storage bill smaller.
CREATE GLOBAL INDEX "byStatus" ON "stage.Outbox" PARTITION KEY (Status) SORT KEY (CreatedAt) PROJECT INCLUDE (Type, Attempts) The byStatusV1 access path has no callers after a migration. Remove its index storage while preserving every item in stage.Orders.
DROP GSI "byStatusV1" ON "stage.Orders"; Related: Tables, indexes & replicas · Targeted reads · SELECT for reading an index · Marker indexes for Kanject's model-declared access paths and uniqueness rules.