我不能使用C#在发电机数据库中加载数据。我们使用了扫描和GetRemaining,这使得这个过程非常慢。是否有任何替代选项可以更快地从加载数据列表?
Table peopleTable = Table.LoadTable(client, "User_Activities_Log");
//get all records
ScanFilter scanFilter = new ScanFilter();
List<Document> allItems = peopleTable.Scan(scanFilter).GetRemaining();加载90万条记录需要5-6分钟。它比SQL慢得多
发布于 2019-09-20 21:52:39
在文档数据库上扫描是一个非常慢的过程。与其进行扫描,不如使用查询,这样可以更快地返回数据,因为它将被索引。
想象一下,扫描就像用拇指翻阅一本书的每一页来查找信息。而不是查询书中的目录来帮助您查找数据。https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LowLevelDotNetQuerying.html
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
var request = new QueryRequest
{
TableName = "Reply",
KeyConditionExpression = "Id = :v_Id",
ExpressionAttributeValues = new Dictionary<string, AttributeValue> {
{":v_Id", new AttributeValue { S = "Amazon DynamoDB#DynamoDB Thread 1" }}}
};
var response = client.Query(request);
foreach (Dictionary<string, AttributeValue> item in response.Items)
{
// Process the result.
PrintItem(item);
} 发布于 2019-09-24 01:29:30
您可以执行分段/并行扫描来并行扫描表。每个段都有自己的迭代器,您可以更快地加载数据。
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.ParallelScan
如果您使用的是预置容量,则应确保您不会被限制。
https://stackoverflow.com/questions/58023607
复制相似问题