Querying & Sorting

Reads are where the bill gets written. Query targets one item collection by key; Scan reads the whole table. Reach for Scan with a filter — the SQL instinct — and you pay for every item read, not the few you keep. That's the classic footgun.

This section is about reading efficiently: using the key to do the work, paging correctly, and ordering results with the sort key instead of in-memory sorting.

0 of 10 readQuiz
Query vs Scan in DynamoDB
Query vs Scan in DynamoDB — Query reads one item collection and bills matched items, Scan reads the whole table before any FilterExpression runs.
Beginner5 min read
Pagination in DynamoDB
How DynamoDB pagination works — loop on LastEvaluatedKey and ExclusiveStartKey, why Limit is not a page size, and how to expose a stateless cursor.
Beginner4 min read
DynamoDB Filtering Strategies
DynamoDB filtering strategies compared — partition key, sort key, sparse indexes, and FilterExpression — and which one actually cuts your read bill.
Intermediate8 min read
Why a DynamoDB Scan Is Slow and Expensive
Why a DynamoDB Scan is slow and expensive, what it actually bills you for, and how to turn a reflexive Scan into a keyed Query that costs a fraction.
Beginner7 min read
DynamoDB Parallel Scans
How DynamoDB parallel scans split a full-table read across workers with Segment and TotalSegments, when they help, and the throughput footgun to avoid.
Advanced7 min read
DynamoDB Sort Key Strategies
DynamoDB sort key strategies for range reads — design a sort key whose byte order matches your read order, so one Query serves many access patterns.
Intermediate8 min read
How to Query DynamoDB in Descending Order
Query DynamoDB in descending order with ScanIndexForward=false — newest-first results, why sorting happens on the sort key, and why reverse reads are free.
Beginner5 min read
Sorting DynamoDB on a Changing Attribute
Sorting DynamoDB on a changing attribute — why a key attribute is immutable, the delete-and-recreate pattern, and moving it to a GSI sort key instead.
Intermediate5 min read
Zero-Padding Sort Keys in DynamoDB
Why "10" sorts before "2" in a DynamoDB string sort key, and how fixed-width zero-padding makes lexicographic byte order match numeric order.
Intermediate5 min read
Knowledge checkTake the quiz
Check what you’ve learned in this section.

Start with Query vs Scan — it's the decision the rest depend on.

Try DynoTable to run these queries against a live table — or compose a full Query/Scan request in the browser with the free query builder.