cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerry Lam <chiling...@gmail.com>
Subject How does clustering key works with TimeWindowCompactionStrategy (TWCS)
Date Thu, 06 Apr 2017 22:30:19 GMT
Hi guys,

I'm a new and happy user of Cassandra. We are using Cassandra for time
series data so we choose TWCS because of its predictability and its ease of
configuration.

My question is we have a table with the following schema:

CREATE TABLE IF NOT EXISTS customer_view (
customer_id bigint,
date_day Timestamp,
view_id bigint,
PRIMARY KEY (customer_id, date_day)
) WITH CLUSTERING ORDER BY (date_day DESC)

What I understand is that the data will be order by date_day within the
partition using the clustering key. However, the same customer_id can be
inserted to this partition several times during the day and the TWCS says
it will only compact the sstables within the window interval set in the
configuration (in our case is 1 hour).

How does Cassandra guarantee the clustering key order when the same
customer_id appears in several sstables? Does it need to do a merge and
then sort to find out the latest view_id for the customer_id? Or there are
some magics happen behind the book can tell?

Best Regards,

Jerry

Mime
View raw message