Partition key and sort key – Referred to as a composite primary key, this type of key is composed of two attributes. The first attribute is the partition key, and the second attribute is the sort key. DynamoDB uses the partition key value as input to an internal hash function.
Is it possible to change partition key in DynamoDB? No. Once the table is setup, you cannot modify its Key Schema. You can only provision a new table, move data there, and then remove the first table.
Global secondary index—An index with a partition key and a sort key that can be different from those on the base table. A global secondary index is considered "global" because queries on the index can span all of the data in the base table, across all partitions.
All items with the same partition key are stored together, in sorted order by sort key value. The combination of the partition key and sort key must be unique. It is possible for two items to have the same partition key value, but those two items must have different sort key values.
1) See my answer here https://stackoverflow.com/a/51240423/4985580 for how tables are partitioned. A GSI is essentially just a new table, it is partitioned in the same way as your base table.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.Partitions.html
Global secondary indexes in DynamoDB are also composed of partitions. The data in a GSI is stored separately from the data in its base table, but index partitions behave in much the same way as table partitions.
2) Yes, 10GB
3) That's an interesting question and I don't have the answer. Dynamo accesses the correct partition based on the partition key of the data, so if you fill more than one partition with a single partition key, it seems likely you would have a problem. That said you'd probably need at least 2.5 Million items with the same partition key for this to happen (10GB/4KB). Is this a possible scenario for you?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With