Reputation: 25711
New to using DynamoDB and NoSQL. How does the GSI work?
If I was to create a table like so:
UserID Email Username
Let's say UserId was my primary key and Email and Username where the composite GSI.
Is the GSI searchable without using UserId and across ALL partions (not just one)? Or does the GSI need to have UserId as part of the GSI?
Upvotes: 0
Views: 100
Reputation: 10056
you can get the full answer here: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html
for your questions - (Is the GSI searchable without using UserId and across ALL partions (not just one)? Or does the GSI need to have UserId as part of the GSI?) - "A global secondary index contains a selection of attributes from the table, but they are organized by a primary key that is different from that of the table. The index key does not need to have any of the key attributes from the table; it doesn't even need to have the same key schema as a table"
UserId dont need to be one of your GSI.
Upvotes: 0