cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DuyHai Doan <doanduy...@gmail.com>
Subject Re: Order By limitation or bug?
Date Thu, 03 Sep 2015 20:46:55 GMT
Limitation, not bug. The reason ?

On disk, data are sorted by type first, and FOR EACH type value, the data
are sorted by id.

So to do an order by Id, C* will need to perform an in-memory re-ordering,
not sure how bad it is for performance. In any case currently it's not
possible, maybe you should create a JIRA to ask for lifting the limitation.

On Thu, Sep 3, 2015 at 10:27 PM, Robert Wille <rwille@fold3.com> wrote:

> Given this table:
>
> CREATE TABLE import_file (
>   roll int,
>   type text,
>   id timeuuid,
>   data text,
>   PRIMARY KEY ((roll), type, id)
> )
>
> This should be possible:
>
> SELECT data FROM import_file WHERE roll = 1 AND type = 'foo' ORDER BY id
> DESC;
>
> but it results in the following error:
>
> Bad Request: Order by currently only support the ordering of columns
> following their declared order in the PRIMARY KEY
>
> I am ordering in the declared order in the primary key. I don’t see why
> this shouldn’t be able to be supported. Is this a known limitation or a bug?
>
> In this example, I can get the results I want by omitting the ORDER BY
> clause and adding WITH CLUSTERING ORDER BY (id DESC) to the schema.
> However, now I can only get descending order. I have to choose either
> ascending or descending order. I cannot get both.
>
> Robert
>
>

Mime
View raw message