Why does AWS Scan LastEvaluatedKey return values even when the key does not exist?
My scan request is
{
"TableName": "tks-processtracker-dumper",
"ExclusiveStartKey": {
"Mykey": {
"S": "AKeyThatDoesntExists"
}
},
"Limit": 2000
}
Even passing a key that does not exist in the table, scanning still returns values.
My question is, should it return values even when the key doesn’t exist? and why?
2
Answers
ExclusiveStartKey is essentially a pointer to a location on the storage medium.
It doesn’t care if the item is there, it hashes the value you submit and that points to a location in disk and the Scan will proceed from that position.
It’s an EXCLUSIVE start key…
It doesn’t have to exist, as DDB starts reading at whatever item has the next higher value.
In SQL it’d look something like