admin管理员组文章数量:1323744
My DynamoDB table schema is:
- identifier (HASH KEY)
- time (RANGE KEY)
I'm trying to improve the response time in a DynamoDB PartiQL query that uses a KeyConditionExpression and BETWEEN.
My 1st query is:
select * from "table_test" where identifier = "product_1" and time > "-1" limit=100
Because of limit=100
, DynamoDB automatically paginates results with LastEvaluatedKey:
[-1, 50000]
[50000, 100000]
[100000, 150000]
[150000, 200000] (focus on this partition, it takes 4 seconds)
[200000, null]
My 2nd query is:
select * from "table_test" where identifier = "product_1" and time between 150000 and 200000
Query #2 takes 10 seconds.
I don't know why query #2 still takes more time than query #1 for the partition 150000-200000.
My question is does DynamoDB still read all items before applying the "BETWEEN" condition?
My DynamoDB table schema is:
- identifier (HASH KEY)
- time (RANGE KEY)
I'm trying to improve the response time in a DynamoDB PartiQL query that uses a KeyConditionExpression and BETWEEN.
My 1st query is:
select * from "table_test" where identifier = "product_1" and time > "-1" limit=100
Because of limit=100
, DynamoDB automatically paginates results with LastEvaluatedKey:
[-1, 50000]
[50000, 100000]
[100000, 150000]
[150000, 200000] (focus on this partition, it takes 4 seconds)
[200000, null]
My 2nd query is:
select * from "table_test" where identifier = "product_1" and time between 150000 and 200000
Query #2 takes 10 seconds.
I don't know why query #2 still takes more time than query #1 for the partition 150000-200000.
My question is does DynamoDB still read all items before applying the "BETWEEN" condition?
Share Improve this question asked Jan 15 at 1:00 Tam Ho ChiTam Ho Chi 11 silver badge1 bronze badge 1- Tips for asking a good Structured Query Language (SQL) question – DarkBee Commented Jan 15 at 6:03
1 Answer
Reset to default 2PartiQL defaults to a Scan when 2 or more conditions are on the where clause. I suggest you use the Query API which will give you the performance you desire.
版权声明:本文标题:amazon web services - DynamoDB still reads all items when using KeyConditionExpression BETWEEN - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742110174a2421212.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论