cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Avi Levi <...@indeni.com>
Subject Re: Getting all unique keys
Date Sun, 20 Aug 2017 06:33:18 GMT
I need to get all unique keys (not the complete primary key, just the
partition key) in order to aggregate all the relevant records of that key
and apply some calculations on it.

*CREATE TABLE my_table (

    id text,

    timestamp bigint,

    value double,

    PRIMARY KEY (id, timestamp) )*

I know that to query like this

*SELECT DISTINCT id FROM my_table *

is not very efficient but how about the approach presented here
<http://www.scylladb.com/2017/02/13/efficient-full-table-scans-with-scylla-1-6/>
sending queries in parallel and using the token

*SELECT DISTINCT id FROM my_table WHERE token(id) >=
-9204925292781066255 AND token(id) <= -9223372036854775808; *

*or I can just maintain another table with the unique keys *

*CREATE TABLE id_only ( id text,

    PRIMARY KEY (id) )*

but I tend not to since it is error prone and will enforce other
procedures to maintain data integrity between those two tables .

any ideas ?

Thanks

Avi

Mime
View raw message