是什么导致卡桑德拉大排? [英] what leads to wide row in cassandra?

查看:248
本文介绍了是什么导致卡桑德拉大排?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 post

create table posts(username varchar, time timeuuid, post_text varchar, primary key(username, time))

CF行的数量与主键中的第一个元素。如果此元素的基数非常低,可能会出现问题,因为您最终可能会获得很宽的CF行。

There will only be as many CF rows as there are variations of the first element in your primary key. This can be a problem if this element has a very low cardinality as you can end up with very wide CF rows.

我的意思是:

我在上面加粗了,这不应该是主键中的第二个元素。
也就是说,辅助元素或群集元素会导致宽行正确吗?

what I have bolded above, shouldn't this be second element in primary key. That is, the secondary element or clustering element causes wide row correct?

推荐答案

这是定义和字典。
一排宽行不是一回事-给出一个定义,我想说的是,在具有PK(分区,聚类)的表中,宽行作为分区键的数量。相反,的数目由每个分区的所有聚类键的总和给出。

It's a problem of definitions and of dictionary. A wide-row and a row are not the same thing -- giving a definition I would say that in a Table with the PK(partition, clustering) there will be as many wide rows as the number of partition keys. The number of rows is instead given by the sum of all clustering keys for each partition.

因此,在您引用的句子中,作者写道:行,但他的意思是宽行。

So in the sentence you quoted the author wrote "rows" but he meant "wide-rows".


CF 宽行 ,因为主键中的
首个元素有所不同。如果此
元素的基数非常低,则可能会出现问题,因为您最终可能会得到 CF
行。

There will only be as many CF wide-rows as there are variations of the first element in your primary key. This can be a problem if this element has a very low cardinality as you can end up with very wide CF rows.

在撰写本文时,可能还没有使用宽行一词。
这样的表

Probably at the time of writing the term wide-row was not so used. So given such a table

CREATE TABLE wide_rows (
  partitionkey text,
  clusteringkey text,
  data text,
  PRIMARY KEY ((partitionkey), clusteringkey)
)

只有分区键宽行,但是行数取决于分区和群集

there will be only partitionkey wide-rows, but rows number depends on both partition and clustering

insert into wide_rows(partitionkey, clusteringkey, data) VALUES ( 'eagertoLearn', 'stackoverflow', 'cassandra question');
insert into wide_rows(partitionkey, clusteringkey, data) VALUES ( 'eagertoLearn', 'google groups', 'cql question');
insert into wide_rows(partitionkey, clusteringkey, data) VALUES ( 'eagertoLearn', 'askubuntu', 'linux shell question');
select * from wide_rows where partitionkey = 'eagertoLearn';

 partitionkey | clusteringkey | data
--------------+---------------+----------------------
 eagertoLearn |     askubuntu | linux shell question
 eagertoLearn | google groups |         cql question
 eagertoLearn | stackoverflow |   cassandra question

(3 rows)

CQL表示我已经返回3行,但是这3行属于同一分区键,因此这是1个宽行。

CQL say that I've got 3 rows back, but these 3 rows belongs to the same partition key so this is 1 wide row.

HTH,
Carlo

HTH, Carlo

这篇关于是什么导致卡桑德拉大排?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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