Limitations of ORDER BY
There are a couple of reasons for which you might want to specify an explicit clustering order at table creation time. First, reversing the clustering order at query time has a slight performance penalty; you don't need to avoid it but, all things being equal, it's best to create the table with the clustering order corresponding to your most frequent access pattern. In the case of status updates, our second table with the reversed clustering order is better, since in most cases we'll want to see the newest status updates first.
Secondly, if you have multiple clustering columns, you might want to order by a mixture of ascending and descending columns. For instance, you might want to store a list of products in ascending ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access