-1

当我使用带有条件的选择查询时,我对 Cassandra 的性能有一点问题,例如:

SELECT name from Perso where age = 18

这需要太多时间,当表格到达 1M 行时,我得到了timedoutexception().

在这种情况下我可以使用分页吗?如果是,如何在请求中使用条件?

4

1 回答 1

0

Cassandra is quick at where clauses if there is low cardinality (i.e. number of rows) in the data, and is notoriously slow when there is a high cardinality.

The Cassandra docs suggest to use one column family to store data and one or more other cfs to act as an indexes for that data.

So for example for your issue you could have two column families - one for Person and another index column family to map an age to a list of names. You can query this second table using the age as the key, and have the list of names returned to you. You can then use the individual returned names to query whatever data you want in the Person column family.

于 2013-05-29T14:18:25.743 回答