From the course: AWS for Developers: DynamoDB

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Querying data

Querying data - Amazon Web Services (AWS) Tutorial

From the course: AWS for Developers: DynamoDB

Start my 1-month free trial

Querying data

- [Instructor] So now that we know that to scan is to simply flip through the records like flipping through cards in a Rolodex. Anybody remember those? With a cost depending on how many items we have to flip through to find our item. So how is querying different than scanning? Well querying data is actually where we find the data based on the primary key, or index, or sort key values. The magic of querying is in a parameter called key condition expression, which allows us to specify the partition and sort key of our table and index, and put that work on the server. Suppose I want to query game stats for a specific date range. I see here that I have six games in my table, but I'm only interested in games between the 15th and the 17th. Now we know one way to do this is to scan it, but that cost won't be good at all, and it won't be performant once we have thousands of games in here. So instead we want to use our partition key, TeamID, and our sort key, the date, to reduce the amount of…

Contents