user269867
user269867

Reputation: 3952

Index size zero for new GSI in DynamoDB

Consider I have a table "table_1" with no GSI. Now, I wanted to add GSI on table_1 which I try doing it via console and I can see on the dashboard that index is created and active. My question is while using boto3 lib fetch function my query doesn't recognize newly created GSI.

I look in to the dynamodb console and found that index size is zero which means the index has not generated for existing items.

Am I right in my understanding?

Upvotes: 1

Views: 1151

Answers (1)

Maurice
Maurice

Reputation: 13117

I don't know what your fetch-function in boto3 is, but indexes in DynamoDB cover existing items even if they're created later.

What you're most likely seeing is that you've set up the index based on attributes that don't exist in your base table so there wasn't anything to replicate into it. In other words: an secondary index only contains items that have all attributes that are part of its key schema. If the index is empty, chances are there is a typo in the key schema.

Upvotes: 3

Related Questions