incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Akash Pandey <akash1...@gmail.com>
Subject Re: CQL query regarding indexes
Date Fri, 13 Jun 2014 13:07:37 GMT
Use senttime as part of primary key
CREATE TABLE services.messagepayload_by_date (
  record_date timestamp
  partition_id uuid,
  messageid bigint,
  senttime timestamp,
  PRIMARY KEY (record_date, senttime )
)

Partition id itself should be chronological say a date. Then you put
partition id in your query (which being a date u can get from the timestamp
you are searching (eg 1401544800000)) and the range of timestamps you
w‚Äčant. You wont need any secondary indices in this solution.
If you need to make some queries on partition id also, keep the original
table but you'll  need the above additional table also for the select query
you mentioned. The select query would look like

SELECT * FROM services.messagepayload_by_date where record_date =
<extracted date from timestamp> and senttime  > <t1 >and senttime < <t2>

Regards
Akash

Mime
View raw message