DynamoDB条件表达式的性能

时间:2018-08-21 17:35:34

标签: amazon-web-services amazon-dynamodb

我有一张像这样的桌子:

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
WebDriverWait(driver, 120).until(lambda x: "query return 0")
WebDriverWait(driver, 120).until(EC."something to wait for")

我正在尝试对{ "TableName": "example-table", "AttributeDefinitions": [ { "AttributeName": "RecordId", "AttributeType": "S" }, { "AttributeName": "UserId", "AttributeType": "S" }, { "AttributeName": "CreatedAt", "AttributeType": "N" }, { "AttributeName": "Version", "AttributeType": "N" } ], "KeySchema": [ { "AttributeName": "UserId", "KeyType": "HASH" }, { "AttributeName": "CreatedAt", "KeyType": "RANGE" } ], "LocalSecondaryIndexes": [ { "IndexName": "RecordIdIndex", "Projection": { "ProjectionType": "ALL" }, "KeySchema": [ { "AttributeName": "UserId", "KeyType": "HASH" }, { "AttributeName": "RecordId", "KeyType": "RANGE" } ] }, { "IndexName": "VersionIndex", "Projection": { "ProjectionType": "KEYS_ONLY" }, "KeySchema": [ { "AttributeName": "UserId", "KeyType": "HASH" }, { "AttributeName": "Version", "KeyType": "RANGE" } ] } ], "ProvisionedThroughput": { "WriteCapacityUnits": 1, "ReadCapacityUnits": 1 } } 属性实施一种乐观锁定,并在Version上使用条件表达式,如下所示:

PutItem

...其中,"NOT ( UserId = :uid AND Version >= :v )在每个呼叫中​​增加一。给定the one example in AWS' documentation与该用例相关的内容(并进行一些手工测试),我的意思是“仅当该用户的文档版本大于或等于时才编写该文档-转到我现在要发送的Version属性。”

但是,我对表达式如何应用于表中的其他文档感到困惑:

  • 该查询会遍历哪个索引(如果有)以满足条件?
  • :v / attribute_exists将如何影响该计划?
  • 如何验证其中任何一个?

0 个答案:

没有答案
相关问题