0

something I don't understand about querying a dynamoDB table is that it seems necessary to include something like .withKeyConditionExpression("itemId = :v_id"), but since the partition key uniquely identifies all items in the table, wouldn't you always be searching just one result?

Trying to do something like:

val expression = DynamoDBQueryExpression<PluginItem>()
                .withKeyConditionExpression("itemId > 0")
                .withFilterExpression("attributes.item_modification_date < :val1")
                .withExpressionAttributeValues(eav)
val paginatedResults = queryByExpression(expression)

I'm looking to query and paginate 100,000 items in the table, can anyone point me in the right direction?

1 Answer 1

1

partition key uniquely identifies all items in the table

so this isn't accurate. It depends on your table design. However, you will get a lot more fexibility if you design a table with a ParitionKey and a Sort Key. That said, back to your statement. A Primary Key not a partition key uniquely identifies an item in the table. A primary key is a combination of ParitionKey + SortKey(also known as Range Key).

Think of each partition as a bucket.

withKeyConditionExpression("itemId > 0")

this won't work. You can't do those kinds of operations on a partition key. However, you can do those kinds of conditions on a sort key.

a video from 2018 - re:Invent that helped me get a better understanding of Dynamo. I have watched that video quite a few times, especially the last 30 to 20mins of it.

Hope that helps. I have only been working with dynamodb for a few months and there is so much more I have to learn.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.