Data Modeling hard
In DynamoDB, 'Single Table Design' packs multiple entity types (User, Order, Item) into one table explicitly. What is the primary technical gain?
- A It provides a more human-readable view of the schema by consolidating multiple disparately related entities into a single, flat table for easier administrator auditing.
- B It enables 'Pre-joined' data retrieval, allowing multiple entity types (e.g., a User and their recent Orders) to be fetched in a single, high-speed physical disk read.
- C It bypasses the database's internal hard limits on individual item size by automatically spanning a single record across multiple physically distributed storage blocks.
- D It allows the DynamoDB engine to natively support complex, ad-hoc SQL queries and multi-table joins that are typically only available in relational databases.
Answer: B. It enables 'Pre-joined' data retrieval, allowing multiple entity types (e.g., a User and their recent Orders) to be fetched in a single, high-speed physical disk read.
Single Table Design is a specialized NoSQL pattern optimized for network efficiency. By carefully crafting Partition Keys and Sort Keys, related items (e.g., User profiles and their associated Orders) can be stored in the same 'Item Collection'. This allows the application to retrieve a complex, hierarchical data structure in a single network round-trip. The trade-off is extreme design rigidity: adding a new query pattern often requires a complete overhaul of the table's key structure or the use of Global Secondary Indexes (GSIs).
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- When modeling a Distributed Transaction using the Saga Pattern (Choreography or Orchestration), what type of consistency do you achieve?
- Which practice prevents SQL Injection attacks?
- What is 'Bi-Temporal' data modeling (e.g., in SQL:2011 standard)?
- Adding an Index to a database column generally improves Read performance. What is the negative trade-off?
- Log Systems Merge (LSM) Trees (used in RocksDB, Cassandra) optimize for fast writes. What is their primary downside regarding Disk I/O?
- What is the primary objective of normalizing a relational database schema (e.g., to 3NF)?