INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

Topic lessonTopic: DynamoDB key design and workload skew

Design DynamoDB keys around access patterns|Compare with SQL Server

Reading an order by ID and listing one customer's orders by date are distinct access patterns. Translate both into key, index and write-cost decisions.

What you will learn

Translate both into key, index and write-cost decisions.

Prerequisite

This exercise uses fictional evidence and makes no changes in a live environment.

Start with the requests

Choose the primary read paths and workload distribution first. A sort key supports ranges within a partition key value.

Choose how to read orders
Choose how to read orders1: Demand — Define the use — Primary. 2: Primary — Design the layout — Secondary. 3: Secondary — Verify equivalent results — Verify123DemandPrimarySecondaryVerifyChoose how to read orders1: Demand — Define the use — Primary. 2: Primary — Design the layout — Secondary. 3: Secondary — Verify equivalent results — Verify123DemandPrimarySecondaryVerify
  1. Demand → PrimaryDefine the use
  2. Primary → SecondaryDesign the layout
  3. Secondary → VerifyVerify equivalent results
Demand
Order ID or customer and dates
Primary
Look up the order ID
Secondary
Query customer and date
Verify
Check results and skew

Compare three synthetic use cases

The workload has frequent order lookups, bounded customer history and occasional complete analytics.
UseCandidateCheck
Show one orderUnique order IDReturn the same synthetic order
Customer historyCustomer and date indexExercise date bounds and ties
All-customer reportingSeparate analytical pathMatch period and row count
Peak periodInclude a dominant customerMeasure the index separately

Flexible SQL Server reports may need an analytical path distinct from operational reads.

Evidence for the decision

Describe each read Record the key, expected result size and distribution requirement.

Check the secondary path Compare index write impact, consistency requirements and charges.

Reevaluate assumptions Review the layout when frequency, writes or analytical needs change.

Check your decision

Choose an option to see the result and explanation.

What comes first for customer history?
Read the answer and reason

Answer: Customer, date range, order and expected result count · Fix the query contract before choosing keys.

How should you treat occasional full-order analytics?
Read the answer and reason

Answer: Compare a dedicated analytical path · Consider frequency and separation of duties.

What establishes equivalence?
Read the answer and reason

Answer: Count, range, ordering and load · Measure the same business results and operating load.

Check, then explain in your own words

  1. List business reads.
  2. Compare primary and secondary paths.
  3. Verify output and load.
Check your understanding: Does copying the SQL Server schema preserve the query experience?

Test the required reads, ordering, consistency and distribution.

The best key depends on access patterns.

Sources and conditions checked

The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.