0
votes

Recently, I 've been trying to create a workaround for a certain issue I have with regards to hash keys.

In my scenario, I have a table that is to contain the basic profile info of a user.. Including 'gender'. The 'gender' attribute specifies whether its a male or female(m, f).. And sometimes I need to query for only males. Am I to create a global secondary index(with 'gender' as the hash key) to perform these queries, considering that similar hash keys resolve to the same physical partition when dynamodb performs its hashing function, and I could end up overloading a single partition since there are only two possible distinct values

1

1 Answers

0
votes

As per this link, each partition in DynamoDB can store 10GB data and support 3k read capacity units (RCUs) and 1k write capacity units (WCUs).

The answer to your question depends on the table size and your provisioned RCUs and WCUs.

  • If the corresponding values for your table are (and, in future, will remain so) within these limits, it should be fine to have a GSI hash-key on gender, because all your data is anyway going to be on one partition.
  • If you can go above these limits, then it is true that you can end up overloading your partitions, depending on your read access patterns.