问题
The reason for this question is:
We are planning to have a UUID as a partition key for an id of a user, company, and load tables for a load board project and we are using DynamoDB.
The thing is when we have thousands of records in a DynamoDB supposedly a user table and I want to search a user with their user-id.
Will the search be more efficient with UUID(ff44393c-bec6-4005-a966-15050fd9bb77) or normal Interger id like (001,002.....)?as partition key.
I could also see that UUID format is a standard which is maintained by most of the application but not sure if their use cases match ours?
回答1:
There is AWS blog which gives recommendations regarding the partition key:
- Choosing the Right DynamoDB Partition Key
One of the recommendations given is:
Use high-cardinality attributes. These are attributes that have distinct values for each item, like e-mailid, employee_no, customerid, sessionid, orderid, and so on.
What's more they write that using sequences is an anti-pattern. Thus, it think UUID
would be better in your case.
来源:https://stackoverflow.com/questions/64746057/what-searching-algorithm-does-dynamodb-use