Reputation: 2535
I have a dynamo table. It has primary key and sortkey. In dynamodb 1 partition can have max of 10GB of data. Can a single primary key be present in multiple partitions means single primary key have multiple sort keys which lead to more than 10GB and crosses partition boundary.
Is there any limitation on max size of single primary/hash key ?
Upvotes: 2
Views: 1676
Reputation: 2174
From the Amazon's Dynamo DB's page
Strings are Unicode with UTF-8 binary encoding. The minimum length of a string can be zero, if the attribute is not used as a key for an index or table, and is constrained by the maximum DynamoDB item size limit of 400 KB.
The following additional constraints apply to primary key attributes that are defined as type string:
- For a simple primary key, the maximum length of the first attribute value (the partition key) is 2048 bytes.
- For a composite primary key, the maximum length of the second attribute value (the sort key) is 1024 bytes.
Upvotes: 2
Reputation: 39186
In short, there is no limitation on primary/sort key. If you have Local Secondary Index (LSI) defined, then the total sizes of all table and index items cannot exceed 10 GB.
In general, there is no practical limit on the number of distinct sort key values per partition key value.
The exception is for tables with local secondary indexes. With a local secondary index, there is a limit on item collection sizes: For every distinct partition key value, the total sizes of all table and index items cannot exceed 10 GB. This might constrain the number of sort keys per partition key value.
Upvotes: 1