Cassandra中列族的行计数 [英] Row count of a column family in Cassandra

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

问题描述

有没有办法得到Cassandra中单列族的行计数(键计数)? get_count只能用于获取列数。



例如,如果我有一个包含用户的列族,并且想要获得用户数。我该怎么办呢?

解决方案

如果你正在处理一个大数据集,并且可以很好的近似,我强烈建议使用命令:

  nodetool --host< hostname> cfstats 

这将为每个列族转储一个列表,如下所示:



列族:widgets
SSTable计数:11
已用空间:4295810363
已用空间:4295810363
键数(估计):9709824
Memtable列数:99008
Memtable数据大小:150297312
Memtable开关计数:434
读数:9716802
读取延迟:0.036 ms。
写计数:9716806
写延迟:0.024 ms。
待处理的任务:0
Bloom Filter False Postives:10428
Bloom Filter False比率:1.00000
Bloom过滤器空间使用:18216448
压缩行最小大小:771
压缩行最大大小:263210
压缩行平均大小:1634

的键(估计)行是一个很好的猜测跨群集,性能是比显式计数方法快很多。


Is there a way to get a row count (key count) of a single column family in Cassandra? get_count can only be used to get the column count.

For instance, if I have a column family containing users and wanted to get the number of users. How could I do it? Each user is it's own row.

解决方案

If you are working on a large data set and are okay with a pretty good approximation, I highly recommend using the command:

nodetool --host <hostname> cfstats

This will dump out a list for each column family looking like this:

Column Family: widgets
SSTable count: 11
Space used (live): 4295810363
Space used (total): 4295810363
Number of Keys (estimate): 9709824
Memtable Columns Count: 99008
Memtable Data Size: 150297312
Memtable Switch Count: 434
Read Count: 9716802
Read Latency: 0.036 ms.
Write Count: 9716806
Write Latency: 0.024 ms.
Pending Tasks: 0
Bloom Filter False Postives: 10428
Bloom Filter False Ratio: 1.00000
Bloom Filter Space Used: 18216448
Compacted row minimum size: 771
Compacted row maximum size: 263210
Compacted row mean size: 1634

The "Number of Keys (estimate)" row is a good guess across the cluster and the performance is a lot faster than explicit count approaches.

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

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