Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DynamoDB GSI with range key item count 0

I have a table in DynamoDB that looks like this:

enter image description here

I added a global secondary index on "Category" to the table and it worked fine and gave me the number of items in the table under item count.

I then realized that i actually needed to be able to search for in a particular "Category" but sorted by "UserRating"

So I deleted the GSI and made a new one like this:

enter image description here

This all worked fine I thought, the names where correct the types (string) for Category and (number) for UserRating was correct.

But then after it finished creating the GSI I looked at the console and it is showing item count 0 even though there should be 13 in this testing table as pictured below:

enter image description here

Thanks for your help.

like image 822
Nicholas Muir Avatar asked May 21 '16 04:05

Nicholas Muir


1 Answers

As per Amazon documentation this is being updated approx every 6 hours.

ItemCount - The number of items in the global secondary index. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.

In my case, even though the console was still showing ItemCount zero and was returning no results for scan/query of the index, I was able to successfully query it from my code.

like image 124
Tommy Avatar answered Sep 20 '22 11:09

Tommy