问题
I know tables in DynamoDB require even distribution between shards to utilize read/write capacity, is this true for Global Secondary Indexes too?
回答1:
Yes, GSIs have the same guidelines as regular table indexes. You should follow the same guidelines described in Guidelines for Working with Tables. The Guidelines for Global Secondary Indexes documentation gives an example where a poorly chosen key can lead to hot-spotting and uneven activity accross partitions.:
For example, suppose you have an Employee table with attributes such as Name, Title, Address, PhoneNumber, Salary, and PayLevel. Now suppose that you had a global secondary index named PayLevelIndex, with PayLevel as the hash key. Many companies only have a very small number of pay codes, often fewer than ten, even for companies with hundreds of thousands of employees. Such an index would not provide much benefit, if any, for an application.
Another problem with PayLevelIndex is the uneven distribution of distinct values. For example, there may be only a few top executives in the company, but a very large number of hourly workers. Queries on PayLevelIndex will not be very efficient because the read activity will not be evenly distributed across partitions.
来源:https://stackoverflow.com/questions/29616134/do-global-secondary-indexes-suffer-from-hot-key-issues