Amazon DynamoDB enhances primary key support in global secondary indexes
Amazon DynamoDB now supports primary keys composed of up to eight attributes in global secondary indexes (GSIs), with up to four attributes for the partition key and up to four attributes for the sort key. Previously, partition and sort keys were limited to one attribute each. When you needed primary keys composed of more than two attributes, you had to manually concatenate values into synthetic keys and backfill data before adding new indexes. Multi-attribute partition and sort keys eliminate these requirements by letting you create keys of up to eight attributes directly from existing attributes, making it easier to model diverse access patterns and adapt to new query requirements.
Multi-attribute partition keys improve data distribution and uniqueness. Multi-attribute sort keys enable flexible querying by letting you specify conditions on sort key attributes from left to right. For example, an index with partition key UserId and sort key attributes Country, State, and City lets you query all locations for a user, then narrow results by Country, State, or City.
Multi-attribute keys are available at no additional charge in the Amazon Web Services China (Beijing) Region, operated by Sinnet and the Amazon Web Services China (Ningxia) Region, operated by NWCD. You can create them using the using the Amazon Web Services Management Console, Amazon CLI, Amazon SDKs, or DynamoDB API. To learn more, see Global Secondary Indexes in the Amazon DynamoDB Developer Guide.