Currently I have a dynamodb (of which I cant anymore change the way the data is structured) which has a partition and sortKey but both are pretty much used as the composite primary key of the data (like you have with relational databases). Here an example of the structure:
partitionKey sortKey sendMessageTime
id-1 target-1
id-1 target-2
id-1 message-1/1 dateTime
id-1 message-1/2 dateTime
In here you can see that id would be the same for all the different sortKeys and only the sortKeys are a bit different but not really sortable (the id's in the DB are UUID). Is there a way to make it sortable on sendMessageTime (which is only present with the message-* sortKey) or is my only option to handle this in code? Wanted to limit the amount of message-1/* records I retrieve from dynamodb.