David
David

Reputation: 1650

In DynamoDB, what happens if there is a collision on a Global Secondary Index?

I have a table which I am designing where the partition key and range key will be known and unique. I am trying to design another way to query. Because the sort key of my fields on my GSI will end up being a date field that goes down to the millisecond, I don't expect many collisions, but it is possible that it could happen at some time. What is the response of DynamoDB in this case? If I run a query against the GSI, will it still show both items that collided on the range key?

Upvotes: 1

Views: 1030

Answers (1)

jellycsc
jellycsc

Reputation: 12359

Yes, you can only do query (instead of getItem) on GSIs. If two items have the same partition key in the GSI, you will get both when you query that partition key.

Upvotes: 6

Related Questions