accesspatterns.dev

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.

Orders

These rows are real and already here. Running an operation against them downloads a DynamoDB-compatible engine, about 850 KB, and executes it in this tab.

Try an example

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

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

Run an operation to see the raw engine response.

table Orderskeys pk / skitems 8