Skip to content

An index holds only what you project

Projection decides which attributes an index carries, trading storage against an extra read.

Why

A secondary index is a copy of your items, and you choose how much of each item it copies. The lean index here projects only the order total; the full index projects everything. Both are keyed on order status.

Query the lean index and each row carries only its keys and total. Query the full index and every attribute is there. The lean index is cheaper to store and cheaper to write, but a read that needs the customer or address has to fetch it from the table, one GetItem per row. Project for the read you actually serve.

KEYS_ONLY and INCLUDE indexes are cheap but make reads fetch the rest; ALL avoids the fetch but roughly doubles the index cost.

Try it. Then change it.

Predict what each request will do. Run it, inspect the response, then change a value in the workbench and try again.

  1. The lean index projects only total. Each row comes back with its keys and total, and nothing else.

  2. The same axis, projected ALL: the same orders, now with every attribute. No table fetch, but a costlier index.

  3. On the lean index, getting the customer or address means a GetItem per row back to the table. Here is one of those reads.

OrdersDynamoDB workbench
Ready to run
Explore an access patternSelect to load & run

The lean index projects only total. Each row comes back with its keys and total, and nothing else.

Request
Execute against the local Dynoxide engine
ReturnedFiltered outChanged
pk(pk)
sk(sk)
gsi1pk
gsi1sk
customer
addr
total
lines
ORDER#1001
ORDER#1001S
STATUS#placedS
2026-06-20T09:00ZS
LenaS
12 Mill RdS
38N
2N
ORDER#1002
ORDER#1002S
STATUS#printingS
2026-06-20T09:10ZS
OmarS
5 Quay StS
12N
1N
ORDER#1003
ORDER#1003S
STATUS#placedS
2026-06-20T09:20ZS
YaraS
8 Hill TopS
55N
3N
ORDER#1004
ORDER#1004S
STATUS#shippedS
2026-06-20T09:30ZS
BenS
2 Park LnS
27N
1N
ORDER#1005
ORDER#1005S
STATUS#printingS
2026-06-20T09:40ZS
TariqS
9 Fen RdS
19N
1N
ORDER#1006
ORDER#1006S
STATUS#placedS
2026-06-20T09:50ZS
NiaS
4 Vale ClS
44N
2N
ORDER#1007
ORDER#1007S
STATUS#shippedS
2026-06-20T10:00ZS
ColeS
7 Bridge StS
9N
1N
ORDER#1008
ORDER#1008S
STATUS#placedS
2026-06-20T10:10ZS
IrisS
3 Kiln WayS
61N
4N
Awaiting request
Your next query starts here.

Choose an access pattern above, or build your own request. See what comes back and what it costs.

Powered by DynoxideWASMStarts on your first run · Runs locally in your browser