Cassandra如何对静态列族进行排序

时间:2014-11-04 16:27:46

标签: cassandra cassandra-2.0 datastax

据我所知,在列族级别上指定了比较器。到目前为止,我已经将它与动态列(宽行)一起使用。当您使用CQL创建静态列族时,Cassandra使用哪种比较器?

CREATE TABLE songs (
  id uuid PRIMARY KEY,
  title text,
  album text,
  artist text,
  data blob
);

如果将复合键放入混合中会发生什么。

CREATE TABLE songs (
  id uuid,
  title text,
  album text,
  artist text,
  data blob,
  PRIMARY KEY ((id, title), album)
);

1 个答案:

答案 0 :(得分:2)

http://cassandra.apache.org/doc/cql3/CQL.html#createTablepartitionClustering

http://www.datastax.com/documentation/cql/3.1/cql/ddl/ddl_compound_keys_c.html

  

在给定的物理节点上,给定分区键的行按聚簇列引发的顺序存储。

因此,在第二种情况下,您的分区键为(id, title),并且群集键为album,这意味着给定分区键的所有行将按album