Bird
0
0

How should you approach identifying access patterns and designing the table?

hard🚀 Application Q9 of 15
DynamoDB - Access Patterns and Query Optimization
You have a DynamoDB table with partition key 'CustomerId' and sort key 'InvoiceDate'. Your app needs to query invoices by customer within a date range and also retrieve invoices by their status. How should you approach identifying access patterns and designing the table?
AStore status as the partition key to optimize all queries
BUse only the primary key and filter by status after querying all invoices
CCreate separate tables for each access pattern without indexes
DIdentify both access patterns and consider using Global Secondary Indexes (GSIs) for querying by status
Step-by-Step Solution
Solution:
  1. Step 1: Identify Access Patterns

    Queries by customer and date range use primary key; queries by status require a different access pattern.
  2. Step 2: Use GSIs for Additional Access Patterns

    Global Secondary Indexes allow efficient querying by non-key attributes like status.
  3. Final Answer:

    Identify both access patterns and consider using Global Secondary Indexes (GSIs) for querying by status -> Option D
  4. Quick Check:

    Use GSIs to support multiple access patterns [OK]
Quick Trick: Use GSIs to support multiple access patterns [OK]
Common Mistakes:
MISTAKES
  • Filtering by status after querying all data (inefficient)
  • Ignoring additional access patterns
  • Using status as partition key without considering other queries

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes