Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

gmldba_107428 avatar image
gmldba_107428 asked ·

Does a clustering key in descending order affect performance?

We have a table that record a transaction with timestamp column. The clustering key is the timestamp column descending. Does this affect performance?

performancedata modellingclustering keys
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered ·

@gmldba_107428 No, it shouldn't. Perhaps if you elaborate on why you are concerned, we'd be able to address it. Cheers!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

On other technologies, a clustering key that is descending, that insert files at the beggining of the list all the time, causes disk performance issues. I thought that due to the immutable nature of the files in Cassandra, that wouldn't be the case. I was double checking.

0 Likes 0 · ·

Right. New items do not get inserted at write time -- just gets appended to the end of the commit log. At a later point in time, the fragments of a partition get coalesced by the compaction process based on the compaction strategy on the table so it won't suffer the same disk performance issue as you described. Cheers!

0 Likes 0 · ·
Gangadhara M.B avatar image
Gangadhara M.B answered ·

Erick R,

Does it means data get appended to commit log but not stored in sorted format immediately ?

What will happen to the client requests which comes before coalese/compaction process runs . When client/application tries to read same data which just got inserted but not got coalesced yet ? does query becomes expensive because it has to query and sort the data then serve/respond to the client which could consume more time and system resources ?

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.