cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michel <4extrama...@gmail.com>
Subject Multiple clustering column and ordering issue.
Date Mon, 18 Apr 2016 14:17:55 GMT
Hello,

We have just started exploring cassandra for our project and learning
basics for designing tables to meet our queries.

We will have a table with following fields :
user_id
list_id
fname
lname
email
AND so on.

We have each user with multiple lists (csv data) so have created table as
below

CREATE TABLE IF NOT EXISTS mykeyspace.table3 (
    user_id int,
    list_id bigint,
    id timeuuid,
    fname text,
    lname text,
    PRIMARY KEY (user_id,list_id,id)
);

With above table we can execute below queries
1) fetch all data of one user_id with "WHERE user_id = ?".
2) fetch all data of one specific list_id of one user with "WHERE user_id =
? AND list_id = ?".

Also using SASI index on fname, lname, email and other fields we can
perform search
3) search from all records of one user_id (regardless of list_id)
4) search from all records of one list_id for one user_id

Now the only issue with this table is ordering of data. With this table we
can not order data by id field as below
WITH CLUSTERING ORDER BY (id DESC);

Records are ordered by list_id by default which is not useful for default
ordering.

Can anyone help here or suggest if we are missing something?

Thanks!

Mime
View raw message