We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Vishu • 2 years ago

Nice article, But I have a query- Using Boto3, I need to sort(desc) the data on the basis of the column having string field(contains date format: YYYYMMDD_HHMMSS) but it is not a sort key. Is it possible?

Alex D • 2 years ago

Hey Vishu -- nope, you can't naturally sort on that. You'd have to read all the data with that partition key, then sort yourself in memory.

How many items have that partition key? Is that feasible?

If not, can you make the datetime column be your sort key? Could be in either your main table or a secondary index.

Vishu • 2 years ago

For now it is feasible. But The table do have the sort key which I am not using in the query. I need to look into the GSI but for now I don't have any idea.
result = TABLE.query(
KeyConditionExpression="partitionKey = :pk",
ExpressionAttributeValues={
":pk": partitionKey
}
)
The data is like this returned by this query:
[
{
"id": "colV",
"url": is the sort key,
"dateColumn": "20231104_122600",
# ...
},
{
"id": "colV",
"url": is the sort key,
"dateColumn": "20231105_122600",
# ...
},
{
"id": "colX",
"url": is the sort key,
"dateColumn": "20231114_122600",
# ...
},
{
"id": "colX",
"url": is the sort key,
"dateColumn": "20231105_122600",
# ...
},
# ...
]
So for every id the dateColumn is to be sorted in descending order.
Thanks.

Jill Harris • 4 years ago

Can you suggest a nursing term paper writing service? I have stuck on a few nursing case studies. I do need a professional assistance. Hope to get some piece of advice.

Lisa Copeland • 4 years ago

Nice article!

Daniel Ponce • 4 years ago

It's better to filter in the application or to use filter like this in DynamoDB. For example if you have to filter a million of records. Filter uses more time? (Because first read and then filter). Thanks

Yueming • 5 years ago

thanks for sharing Alex, great article about dynamo,
Quick question i am trying to understand further: let's say we want to query data from the same partition, with timestamp as sorting key, the data within the same partition key is more than 1MB, e.g., 4MB in total, is it possible to speed up the query by roughly 4 or 5 queries concurrently (in parallel in this case, and assuming we have a perfect even data distribution with timestamp) with different sort key (ranges) from application side, so that we can query the same partition concurrently, with which to avoid the pagination?

Alex D • 5 years ago

Hey Yueming ! You could definitely do that, provided you knew the sort keys necessary for each Query. If your timestamps are predictable, as you mention, you should be able to split it up into different ranges and fetch them in parallel.

The only other thing I'd note is the partition throughput limits of 3000 RCUs/second on a given partition. You should still be fine here -- 1 MB of data is 250 RCUs (strongly consistent), so even doing 4 at the same time would only hit 1000.