ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 119 - DVA-C02 discussion

Report
Export

A company has an ecommerce application. To track product reviews, the company's development team uses an Amazon DynamoDB table.

Every record includes the following

• A Review ID a 16-digrt universally unique identifier (UUID)

• A Product ID and User ID 16 digit UUlDs that reference other tables

• A Product Rating on a scale of 1-5

• An optional comment from the user

The table partition key is the Review ID. The most performed query against the table is to find the 10 reviews with the highest rating for a given product.

Which index will provide the FASTEST response for this query"?

A.
A global secondary index (GSl) with Product ID as the partition key and Product Rating as the sort key
Answers
A.
A global secondary index (GSl) with Product ID as the partition key and Product Rating as the sort key
B.
A global secondary index (GSl) with Product ID as the partition key and Review ID as the sort key
Answers
B.
A global secondary index (GSl) with Product ID as the partition key and Review ID as the sort key
C.
A local secondary index (LSI) with Product ID as the partition key and Product Rating as the sort key
Answers
C.
A local secondary index (LSI) with Product ID as the partition key and Product Rating as the sort key
D.
A local secondary index (LSI) with Review ID as the partition key and Product ID as the sort key
Answers
D.
A local secondary index (LSI) with Review ID as the partition key and Product ID as the sort key
Suggested answer: A

Explanation:

This solution allows the fastest response for the query because it enables the query to use a single partition key value (the Product ID) and a range of sort key values (the Product Rating) to find the matching items. A global secondary index (GSI) is an index that has a partition key and an optional sort key that are different from those on the base table. A GSI can be created at any time and can be queried or scanned independently of the base table. A local secondary index (LSI) is an index that has the same partition key as the base table, but a different sort key. An LSI can only be created when the base table is created and must be queried together with the base table partition key. Using a GSI with Product ID as the partition key and Review ID as the sort key will not allow the query to use a range of sort key values to find the highest ratings. Using an LSI with Product ID as the partition key and Product Rating as the sort key will not work because Product ID is not the partition key of the base table. Using an LSI with Review ID as the partition key and Product ID as the sort key will not allow the query to use a single partition key value to find the matching items.

Reference: [Global Secondary Indexes], [Querying]

asked 16/09/2024
Jonny McKitrick
40 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first