Data Modeling in NoSQL
In the context of NoSQL data modeling, which approach is most efficient for querying user order history in a single request, assuming each user has thousands of orders?
- Denormalizing order data within each user record
- Using a highly normalized relational schema
- Splitting orders into multiple tables by year
- Storing each order in a separate file on disk
- Aggregating order IDs in a query-time loop
Partition Key Selection
When designing a table to store sensor data where each sensor generates millions of records daily, which is the best reason for choosing a composite primary key with a sensor ID partition key and a timestamp sort key?
- It enables efficient queries on a single sensor’s time series data
- It limits duplicate data by design
- It reduces storage costs by compressing the partition key
- It automatically enforces referential integrity between sensors
- It prevents eventual consistency issues on write operations
Global Secondary Indexes
Which statement best describes a scenario where a global secondary index is essential in a table storing product catalog data?
- You need to query products by category regardless of the partition key
- You want to enforce uniqueness of product names
- You only require queries on primary key attributes
- You need to store large binary files as attributes
- You are optimizing bulk write throughput
Eventual Consistency Implications
Given a high-traffic application using eventual consistency for reads, what is a potential risk if two clients read the same item immediately after an update?
- Clients may observe stale data until full replication occurs
- Table schema will become inconsistent
- Data will be permanently lost from the system
- Write throughput will be throttled for those clients
- Clients will always observe the most recent update
Conditional Writes in NoSQL
If you want to prevent overwriting an existing attribute in a NoSQL item unless it matches a specific value, which mechanism should you use?
- Conditional expressions in write operations
- Batch get requests
- Manual sorting of attributes
- Read-after-write consistency
- Incremental backup configuration