Match your query's ORDER BY to the clustering order - Deepstash

Match your query's ORDER BY to the clustering order

Cassandra stores columns on disk in the clustering order of your table. Therefore, to get the performance, your queries with ORDER BY should match the table's clustering order.

For example, if you often query the newest data in the table, then you should set your clustering order to be (insertion_time DESC):

CREATE TABLE timeseries ( event_type text, insertion_time timestamp, event blob, PRIMARY KEY (event_type, insertion_time) ) WITH CLUSTERING ORDER BY (insertion_time DESC);

1

8 reads

CURATED FROM

IDEAS CURATED BY

ocpodariu

Alt account of @ocp. I use it to stash ideas about software engineering

The idea is part of this collection:

Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Related collections

Similar ideas to Match your query's ORDER BY to the clustering order

Match your product to the right stores

Your retail strategy needs to match the marketability and USP of your product with the right store. This means considering factors such as the location of a store, how it fits into the local community, and whether or not your product will be appealing to its customers.

You may find that ret...

How to give better PowerPoint presentations and improve your slides to keep an audience engaged

Not every presentation is linear, and you might prefer to jump back and forth from sections of your deck to a common "table of contents," so you can tackle the presentation in any order. This can be handy, for example, if you're using a deck for training or education. PowerPoint's Zoom feature is...

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Personalized microlearning

100+ Learning Journeys

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates