k1 t1, k2 t2, ..., kn tn
where ki is the name of the i-th key and ti is the type of the i-th key. Then, the order data is stored in a dictionary sort, where each dimension is compared using this type of comparator.
Then (a1, a2,…, an) (b1, b2,…, bn) If a1
For example, consider the pattern
create table clustering (
x text,
k1 text,
k2 int,
k3 timestamp,
y text,
primary key (x, k1, k2, k3)
);
If you did the following insert:< /p>
insert into clustering (x, k1, k2, k3, y) values ('x','a', 1, '2013-09-10 14:00+0000 ', '1');
insert into clustering (x, k1, k2, k3, y) values ('x','b', 1, '2013-09-10 13:00+0000', '1');
insert into clustering (x, k1, k2, k3, y) values ('x','a', 2, '2013-09-10 13:00+0000', '1 ');
insert into clustering (x, k1, k2, k3, y) values ('x','b', 1, '2013-09-10 14:00+0000', '1') ;
Then they are stored on the disk in this order (the order of clusters returned from x =’x’ select *):
x | k1 | k2 | k3 | y
---+----+----+------------------------- -+---
x | a | 1 | 2013-09-10 14:00:00+0000 | 1
x | a | 2 | 2013-09-10 13:00:00+ 0000 | 1
x | b | 1 | 2013-09-10 13:00:00+0000 | 1
x | b | 1 | 2013-09-10 14:00:00+0000 | 1
k1 sort dominates, then k2, then k3.
On a given physical node, the rows of a given partition key are stored in the order triggered by the cluster key, so that the rows in the cluster order are retrieved Especially effective. http://cassandra.apache.org/doc/cql3/CQL.html#createTableStmt What sort of clustering key causes?
Assuming your cluster key is
k1 t1, k2 t2, ..., kn tn< /pre>where ki is the name of the i-th key and ti is the type of the i-th key. Then, the order data is stored in a dictionary sort, where each dimension is compared using this type of comparator.
Then (a1, a2,..., an) (b1, b2,..., bn) If a1
to find all rows where ki = x. In fact, such a query is not allowed-the only allowed clustering key limit specifies zero or more clustering keys, from the first none The lost begins first. For example, consider the pattern
create table clustering (
x text,
k1 text,
k2 int,
k3 timestamp,
y text,
primary key (x, k1, k2, k3)
);If you did the following insert:< /p>
insert into clustering (x, k1, k2, k3, y) values ('x','a', 1, '2013-09-10 14:00+0000 ', '1');
insert into clustering (x, k1, k2, k3, y) values ('x','b', 1, '2013-09-10 13:00+0000', '1');
insert into clustering (x, k1, k2, k3, y) values ('x','a', 2, '2013-09-10 13:00+0000', '1 ');
insert into clustering (x, k1, k2, k3, y) values ('x','b', 1, '2013-09-10 14:00+0000', '1') ;Then they are stored on the disk in this order (the order of clusters returned from x ='x' select *):
x | k1 | k2 | k3 | y
---+----+----+------------------------- -+---
x | a | 1 | 2013-09-10 14:00:00+0000 | 1
x | a | 2 | 2013-09-10 13:00:00+ 0000 | 1
x | b | 1 | 2013-09-10 13:00:00+0000 | 1
x | b | 1 | 2013-09-10 14:00:00+0000 | 1k1 sorting dominates, then k2, then k3.