order by子句不适用于cassandra CQLSH

时间:2014-08-05 06:58:46

标签: cassandra cqlsh

我想要与此类似的查询

SELECT uuid,data,name,time,tracker,type,userid FROM standardevents080406 ORDER BY userid DESC;

但是在子句查询正常工作的地方它不起作用。

SELECT uuid,data,name,time,tracker,type,userid FROM standardevents080406 where userid='64419';
我做错了什么..

column-family描述如下

CREATE TABLE standardevents080406 (   uuid uuid PRIMARY KEY,   data text,   name text,   time text,   tracker text,   type text,   userid text ) WITH 
  bloom_filter_fp_chance=0.010000 AND   caching='KEYS_ONLY' AND   comment=''
 AND   dclocal_read_repair_chance=0.000000 AND   gc_grace_seconds=864000 AND  read_repair_chance=0.100000 AND   replicate_on_write='true'
 AND   populate_io_cache_on_flush='false' AND 
  compaction={'class': 'SizeTieredCompactionStrategy'} AND  
 compression={'sstable_compression': 'SnappyCompressor'};

CREATE INDEX time_ind ON standardevents080406 (time);

CREATE INDEX userid_ind ON standardevents080406 (userid);

1 个答案:

答案 0 :(得分:1)

您不能对不属于群集密钥的列执行ORDER BY。 您的表定义不包含任何群集键,而是一个简单的主键。在您的情况下,排序只能在客户端执行。

HTH, 卡罗