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

Reply via email to