jd96
jd96

Reputation: 595

Do DynamoDB secondary indexes contain actual table rows?

In the SQL world when you create a non clustered index it creates a separate data structure that allows you to find pointers to table rows based on a key that is not the primary key of the table.

From the DynamoDB docs it seems as though creating a secondary index creates a separate data structure that holds a copy of the actual table rows, not just a pointer to those rows.

Is that right?

Upvotes: 0

Views: 326

Answers (1)

Maurice
Maurice

Reputation: 13117

That's partially correct - for a global secondary index, it will definitely create a second table and update that asynchronously based on the changes in the primary table. That's why you can only do eventually consistent reads on this index.

For local secondary indexes it's most likely the same table.

There is a talk from re:invent 2018, where they explain the underlying data structures, which I can highly recommend:

AWS re:Invent 2018: Amazon DynamoDB Under the Hood: How We Built a Hyper-Scale Database (DAT321)

Upvotes: 4

Related Questions