标准色谱柱系列和超级柱系列 [英] standard column family vs super column family

查看:181
本文介绍了标准色谱柱系列和超级柱系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到某处,表示对于在标准列族中有成千上万列的行,更好的设计将它们分割成超级列,这样读取将非常有效,因为cassandra只需要加载和返回在给定的超级列名称下的列,而不是加载并且可能返回列的列。任何人都可以确认?

I read somewhere indicating that for a row having thousands of columns in a standard column family, better design to split them into super columns, and by doing so, the read would be very efficient as cassandra will only need to load and return the columns under a given super column name, instead of load and possibly return the thoudsands of columns. Can anyone please confirm?

推荐答案

这不是好建议。在这一点上,存在非常少的用例,其中超列是最好的解决方案。新的CompositeTypes对于历史上使用的大多数超级列都是一个更好的解决方案。

That's not good advice. At this point, there are very small number of use cases for which super columns are the best solution. The new CompositeTypes are a better solution for most of what super columns have been used for historically.

据说,这听起来你不需要CompositeTypes。这是真的,如果你正在读一个非常大的行,你不应该一次拉回整行。

With that said, it sounds like you don't need CompositeTypes here either. It's true that if you're reading a very large row, you shouldn't pull back the entire row at once. Instead, you should fetch portions of the row in contiguous slices.

基本上,你将执行一系列 get_slice() s。对于第一个,将列计数设置为1000,列开始为。然后,从该组结果中取出最后一个列名(称为X),并使用列计数1000进行另一个 get_slice()调用,但这次设置列开始为X.放弃第一个返回的列(它将是X),然后重复整个 get_slice()过程,直到查询返回少于1000列

Basically, you'll be performing a series of get_slice()s. For the first one, set the column count to, say, 1000, and the column start to "". Then, take the last column name from that set of results (call it X), and make another get_slice() call with a column count of 1000, but this time, set the column start to X. Discard the first column you get back (it will be X), and then repeat the whole get_slice() process until the query returns less than 1000 columns, which signals that you've hit the end of the row.

您可能希望每次提取多于或少于1000个,具体取决于列大小。

You may want to fetch more than or less than 1000 at a time, depending on your column size.

这篇关于标准色谱柱系列和超级柱系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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