Do Global Secondary Indexes suffer from hot key issues

瘦欲@ 提交于 2021-01-02 20:49:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!