KindleYou is a location-based social search mobile app that allows users to like or dislike other users, and allows users to chat if both parties liked each other in the app.
It has more than 1 billion customers across the world. They use DynamoDB to support the mobile application and S3 to host the images and other documents shared between users. The application tracks number of friends of all users, but need to populate TOP 10 customers who has highest number of friends.
select 1 option.
Click on the arrows to vote for the correct answer
A. B. C. D.Answer:A.
Option A is correct - Add a Boolean attribute ‘Is_Top_Friendly' to the table and add a sparse index.
Sparse indexes are useful for queries over a small subsection of a table.
Option B is incorrect -Aggregation of data for maintaining near real-time aggregations and key metrics on top of rapidly changing data is becoming increasingly valuable to businesses for making rapid decisions.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-gsi-aggregation.htmlOption C is incorrect -Overloading GSI only addresses adding different fields as to cater different queries.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-gsi-overloading.htmlOption D is incorrect -To enable selective queries across the entire key space, you can use write sharding by adding an attribute containing a (0-N) value to every item that you will use for the global secondary index partition key.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-indexes-gsi-sharding.htmlTo find the top 10 customers with the highest number of friends, we need to perform a query that retrieves the necessary information from the DynamoDB table.
Option A: Using Global Secondary Sparse Indexes Global Secondary Sparse Indexes can be used to create an index on a specific attribute of the table. This option can be useful if the attribute that needs to be indexed has a low cardinality (a small number of unique values). However, since we need to find the top 10 customers with the highest number of friends, this option may not be the best fit as it would require a full scan of the index and sorting the results in descending order, which could be time-consuming and resource-intensive.
Option B: Using Aggregation Aggregation is a technique used to group data and perform calculations on groups. While this option could be useful for finding the sum or average number of friends of all customers, it may not be the best option for finding the top 10 customers with the highest number of friends. Aggregation would require retrieving all of the data from the table and performing calculations on the data in memory, which could be inefficient and require a lot of resources.
Option C: Using Global Secondary Index Overloading Global Secondary Index Overloading is a technique used to add multiple attributes to a Global Secondary Index. This option could be useful if we were querying on multiple attributes, but since we only need to query on the number of friends attribute, this option may not be the best fit.
Option D: Using Global Secondary Index Sharding Global Secondary Index Sharding is a technique used to partition a Global Secondary Index across multiple nodes. This option may not be the best fit as it is designed to improve performance and scalability for large tables with high write throughput.
Overall, the best option for this scenario is to perform a full scan of the DynamoDB table and sort the results in descending order based on the number of friends attribute. DynamoDB is optimized for retrieving large amounts of data, and with proper indexing and projection, the query can be performed efficiently.