Cassandra Limit 10,20条款 [英] Cassandra Limit 10,20 clause
本文介绍了Cassandra Limit 10,20条款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是Cassandra 1.2.3,可以使用Limit 10执行select查询。
I am using Cassandra 1.2.3 and can execute select query with Limit 10.
如果我想要10到20的记录, 20。
If I want records from 10 to 20, I cannot do "Limit 10,20".
以下查询给我一个错误。
Below query gives me an error.
select * from page_view_counts limit 10,20
如何实现?
感谢
Nikhil
Thanks Nikhil
推荐答案
你不能在CQL中跳过。您必须通过指定开始位置进行分页例如
You can't do skips like this in CQL. You have have to do paging by specifying a start place e.g.
select * from page_view_counts where field >= 'x' limit 10;
以获取从x开始的接下来的10个元素。
to get the next 10 elements starting from x.
我在这个答案中写了一个完整的例子: Cassandra分页:如何使用get_slice从Python使用cql库查询Cassandra 1.2数据库。
I wrote a full example in this answer: Cassandra pagination: How to use get_slice to query a Cassandra 1.2 database from Python using the cql library.
这篇关于Cassandra Limit 10,20条款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文