General thoughts DynamoDB:
Please do not think about DynamoDB, like MySQL. DynamoDB is just the key: a repository of values ββwith a few subtleties.
Primary Key: The value is stored:
Or you know the key, and get your value;
Or you will not do this, and get the whole table.
In the specific case of DynamoDB you can
- Get an item, knowing the whole key, with
GetItem - Extract all the elements under the given
hash_key , possibly using a filter, with Query - Extract the entire table, possibly using filters, using
Scan
This suggests that Scan is slow and expensive. You should never use it, otherwise your design will most likely be wrong.
Specific for your question:
In your case, it seems that you want to split your key into
Then you can use Query to get all elements sharing hash_key . With Query you can apply filters such as BEGINS_WITH to narrow the scope.
Note that all ( hash_key , range_key ) tuples must be unique.
source share