0
0
DynamoDBquery~30 mins

Why access patterns drive design in DynamoDB - See It in Action

Choose your learning style9 modes available
Designing a DynamoDB Table Based on Access Patterns
📖 Scenario: You are building a simple online bookstore database using DynamoDB. You want to design the table so that it efficiently supports the ways users will look up books.
🎯 Goal: Build a DynamoDB table design step-by-step that matches the access patterns for retrieving books by ISBN and listing books by author.
📋 What You'll Learn
Create a DynamoDB table schema with a primary key
Add a secondary index to support querying books by author
Write a query to get a book by its ISBN
Write a query to list all books by a specific author
💡 Why This Matters
🌍 Real World
Designing DynamoDB tables based on how the application will access data ensures fast and cost-effective queries.
💼 Career
Understanding access patterns and designing NoSQL tables accordingly is a key skill for cloud database developers and architects.
Progress0 / 4 steps
1
Create the DynamoDB table with primary key
Create a DynamoDB table called Books with a primary key named ISBN of type string.
DynamoDB
Need a hint?

The primary key uniquely identifies each book. ISBN is a good choice because it is unique for every book.

2
Add a secondary index for author queries
Add a Global Secondary Index (GSI) named AuthorIndex on the Books table with Author as the partition key of type string to support queries by author.
DynamoDB
Need a hint?

The GSI lets you efficiently find all books by the same author.

3
Write a query to get a book by ISBN
Write a DynamoDB query expression to get a book item from the Books table using the primary key ISBN with a value of "978-0132350884".
DynamoDB
Need a hint?

Use the primary key ISBN to get the exact book.

4
Write a query to list books by author
Write a DynamoDB query expression to list all books by the author "Robert C. Martin" using the AuthorIndex GSI.
DynamoDB
Need a hint?

Use the AuthorIndex GSI to find all books by the author.