列数与计数器列性能 [英] Columns count vs counter column performance

查看:76
本文介绍了列数与计数器列性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道什么是获取特定列族中列数的最佳方法.我可以直接获取列数,但是不确定这是否是有效的解决方案.另一方面,我可以使用包含列数的计数器列来维护另一个列族.您有类似问题的经验吗?

解决方案

http://wiki.apache.org/cassandra/API 解释了get_count方法:

...不是O(1).它需要磁盘中的所有列来计算回答.该方法的唯一好处是您不需要拉Thrift界面上的所有列进行计数.

如果您仅偶尔需要计数和/或列数很小,那么这可能没关系.

如果性能很重要,那么您最好选择柜台.

请参见 http://www.datastax.com/dev/blog/whats-new-in-cassandra-0-8-part-2-counters

如何在Cassandra中增加计数器?

I am wondering what is the best way to get the number of columns in a particular column family. I can get the number of columns directly but I am not sure if it is efficient solution. On the other hand I can maintain another column family with a counter column that holds the number of columns. Do you have any experience with similar problems?

解决方案

http://wiki.apache.org/cassandra/API explains that the get_count method:

...is not O(1). It takes all the columns from disk to calculate the answer. The only benefit of the method is that you do not need to pull all the columns over Thrift interface to count them.

If you only need the count very occasionally, and/or the number of columns is small, then this may not matter.

If performance matters, then you'd be better off with counters.

See http://www.datastax.com/dev/blog/whats-new-in-cassandra-0-8-part-2-counters

and How to increment a counter in Cassandra?

这篇关于列数与计数器列性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆