我有一个带有范围键 CreationDate 的消息表...
我将如何查询任意页面?这是否可能无需提供上一个查询返回的 LastEvaluatedKey?这意味着客户端还必须跟踪它并在每个请求中返回它。这不允许您在不进行每个中间查询的情况下跳转到任意页面。
我是否必须更新另一个仅包含 PageKey = someTimestamp 的表 MessagePageKeys 才能实现快速页面检索?
QueryRequest queryReq = new QueryRequest();
queryReq.WithTableName(tableName);
queryReq.WithLimit(perPage);
var startIndex = startPage * perPage;
queryReq.WithExclusiveStartKey(new Key
{
HashKeyElement = new AttributeValue().WithN(hashKeyValue),
RangeKeyElement = new AttributeValue().WithN(prevKey.ToString() )
});
// sort by newest (highest time signature)
queryReq.ScanIndexForward = false;