jimmone
jimmone

Reputation: 466

AWS DynamoDB GSI query all partitions

I saw the following sentence in AWS DynamoDB documentation: A global secondary index lets you query over the entire table, across all partitions. I am wondering what this really means. I thought it meant that you could use > for example in a KeyConditionExpression for the hash key but apparently you can't.

Upvotes: 2

Views: 983

Answers (1)

Chris Williams
Chris Williams

Reputation: 35213

A query is performed against a certain partition key (sometimes referred to as the hash key) whether its the global secondary index or the base table.

What the documentation is trying to explain is that you can reorganise the structure of a GSI to have its own partition and range keys (seperate from the original table). By doing this you can query across a larger range of data as the base partitions have changed.

If every value had the same partition key in a GSI you could query against the whole dataset.

You can also use other operators for the range keys or other attributes.

Upvotes: 3

Related Questions