UUIDs for DynamoDB?

前端 未结 6 1090
滥情空心
滥情空心 2020-12-14 00:02

Is it possible to get DynamoDB to automatically generate unique IDs when adding new items to a table?

I noticed the Java API mentions @DynamoDBAutoGeneratedKey so I\

6条回答
  •  余生分开走
    2020-12-14 00:53

    The client can create a (for all intents and purposes) unique ID either by picking a long random id (DynamoDB supports 128-bit integers, for example), or by picking an ID which contains the client's IP address, CPU number, and current time - or something along these lines. The UUID standard even includes a standard way to do this (and you have libraries in various languages to create such UUIDs on the client side), but you don't really need to use a standard. And interesting question is how do you plan to find these items if they have random keys. Or are you planning to use a secondary index?

提交回复
热议问题