If i am using sing primary key in my table in that situation ORDER BY is possible in cassandra cqlsh query. Is there any solution for this.
Asked
Active
Viewed 419 times
1 Answers
1
Is it possible for cassandra cqlsh ORDER BY with out using composite and super column?
--> Yes, provided that you define your "ordering column" as the first clustering component (e.g. second component of the compound primary key)
Quote from the official doc :
ORDER BY clauses can select a single column only. That column has to be the second column in a compound PRIMARY KEY. This also applies to tables with more than two column components in the primary key. Ordering can be done in ascending or descending order, default ascending, and specified with the ASC or DESC keywords.
This also works when you define your table using the WITH COMPACT STORAGE option (not using composite).

Community
- 1
- 1

doanduyhai
- 8,712
- 27
- 26
-
your correct if my table structure is like is mean CREATE TABLE sample(id varchar PRIMARY KEY ,name varchar, lanme varchar, time timeuuid) WITH COMPACT STORAGE ; is it possible for order by – Hari Haran Sep 30 '13 at 11:25
-
Becouse my erlang client not supported composite column that's why i am trying for query like this, is there any solution without using compound primary key in cassandra cqlsh – Hari Haran Sep 30 '13 at 11:27
-
"is there any solution without using compound primary key in cassandra cqlsh" --> No, compound primary key is mandatory if you want to do ORDER BY – doanduyhai Sep 30 '13 at 13:47