问题
I am a newbie in Cassandra.
Does Cassandra follow any specified sorting algorithm like bubble sort
, binary sort
, etc.? If not, How does it sort in order by command?
回答1:
It doesn't, or at least it shouldn't. In Cassandra you build your data model around your use cases. So if you want to retrieve sorted data you have to store it sorted. If you want the same data sorted in different ways, you store the same data multiple times sorted differently. There is a lot more to read about how Cassandra works, and I think every user of Cassandra should.
Links related to your question:
- https://docs.datastax.com/en/cql/3.3/cql/cql_using/useSimplePrimaryKeyConcept.html
- https://docs.datastax.com/en/cql/3.3/cql/cql_using/useCompoundPrimaryKeyConcept.html
- https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateIndex.html
Getting started with Cassandra:
- https://academy.datastax.com/courses (the first two courses is a must do. You need to register but they 100% free)
来源:https://stackoverflow.com/questions/47263785/how-is-sorting-done-in-cassandra