简体   繁体   中英

How do GSI (Global Secondary Index) work?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM