AWS SimpleDB where 子句 'and'操作员行为异常
以下 simpledb 查询返回 51 个结果:
select * from logger where time > '2011-07-29 17:45:10.540284+00:00'
此查询返回 20534 个结果:
select * from logger where time < '2011-07-29 17:50:08.615626'
这两个查询都返回 0 个结果!!?:
select * from logger where time between '2011-07-29 17:45:10.540284+00:00' and '2011-07-29 17:50:08.615626'
select * from logger where time > '2011-07-29 17:45:10.540284+00:00' and time < '2011-07-29 17:50:08.615626'
我在这里缺少什么?
The following simpledb query returns 51 results:
select * from logger where time > '2011-07-29 17:45:10.540284+00:00'
This query returns 20534 results:
select * from logger where time < '2011-07-29 17:50:08.615626'
These two queries both return 0 results!!?:
select * from logger where time between '2011-07-29 17:45:10.540284+00:00' and '2011-07-29 17:50:08.615626'
select * from logger where time > '2011-07-29 17:45:10.540284+00:00' and time < '2011-07-29 17:50:08.615626'
What am I missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
但是,第一个查询返回的 51 个结果中的任何一个实际上都在您搜索的时间范围内吗?如果它们都晚于 17:50:08.615626,那么您的查询将按预期执行。
我还怀疑你对时间的表述不一致。如果您希望时间与 SDB 的字典顺序匹配一致,那么您确实应该使用 ISO 8601 时间戳。
另一个选项是查询运行时间超过查询超时时间,您是否检查错误?
最后 - 也许 SDB 的日子不好,查询有点慢 - 在这种情况下,你会发现你得到 0 个结果,但确实得到了下一个令牌 - 实际结果将在下一批中出现。
这些有帮助吗?
But are any of your 51 results returned from the first query actually within the time span you are searching? If they are all later than 17:50:08.615626 then your queries are performing as expected.
I am also suspicious of the fact that you are being inconsistent in how you are representing the time. You should really be using ISO 8601 timestamps if you want consistent lexicographic matching of times with SDB.
The other option is that the queries are taking longer than the query timeout to run, are you checking for errors?
Finally - perhaps SDB is having a bad day and the query is just a bit slow - in those circumstances you can find you get 0 results but DO get a next token - and the actual results follow in the next batch.
Does any of that help?