tbsalling
tbsalling

Reputation: 4545

Does DateTieredCompactionStrategy work with composite keys?

Does DateTieredCompactionStrategy in Apache Cassandra 2.1.2. work with a compound clustering key?

More specifically, like with this table where (timestamp, hash) makes up a compound clustering key:

CREATE TABLE sensordata (
    timeblock int,
    timestamp timestamp,
    hash int,
    data blob,
    PRIMARY KEY (timeblock, timestamp, hash)
)

I believe, that the DateTieredCompactionStrategy would work for PRIMARY KEY (timeblock, timestamp) -- but does it also work for PRIMARY KEY (timeblock, timestamp, hash) ?

Upvotes: 1

Views: 150

Answers (1)

Stefan Podkowinski
Stefan Podkowinski

Reputation: 5249

The DTCS will just merge similar aged tables during compaction. It doesn't really care about your PK. As all rows for your example will still be clustered by timestamp, you should be fine.

Upvotes: 2

Related Questions