import boto
db = boto.connect_dynamodb()
table = db.get_table('MyTable')
res = table.scan(attributes_to_get=['id'], max_results=10)
for i in res:
print i
In case of a scan operation, it is not the size of items returned by scan, rather it is the size of items evaluated by Amazon DynamoDB. That is, for a scan request, Amazon DynamoDB evaluates up to 1 MB of items and returns only the items that satisfy the scan condition.
根据capacity unit calculation的文档,每个请求最多只能分析1MB的数据。在
对于“只有”1000个项的表,理论上每次都会解析所有表。希望“limit”参数(其最大值为100)允许提前停止进程,以便最多返回
limit
项。在如果您的请求不涉及任何条件,则扫描的项目计数将是结果的数量。否则,它可能会大得多,但扫描项目的累积大小不能超过1MB的边界。在
对于扫描操作,亚马逊将视为您消费
但请不要相信我的话:
^{pr2}$要完整地回答您的问题,您还需要知道:以Kb为单位的项的大小是多少,表的配置读取容量是多少。在
如果只扫描表示主索引键(在您的示例中为“id”)的项,而不扫描任何筛选器表达式,则会收到前10项,扫描将停止。在
如果出现以下情况,则不会检索前10项:
或者
相关问题 更多 >
编程相关推荐