Re: Sorting & pagination in apache cassandra 2.1

2016-01-15 Thread Carlos Alonso
Hi Anuja. Yeah, that's what he means. Before Cassandra 3.0 the modelling advice is to have one table per query. This may sound weird from a relational perspective, but the truth is that writes in Cassandra are very cheap, and its better to write multiple times and have quick and easy reads than

Re: Sorting & pagination in apache cassandra 2.1

2016-01-14 Thread anuja jain
@Jonathan what do you mean by "you'll need to maintain your own materialized view tables"? does it mean we have to create new table for each query? On Wed, Jan 13, 2016 at 7:40 PM, Narendra Sharma wrote: > In the example you gave the primary key user _ name is the row

Re: Sorting & pagination in apache cassandra 2.1

2016-01-13 Thread Narendra Sharma
In the example you gave the primary key user _ name is the row key. Since the default partition is random you are getting rows in random order. Since each row no clustering column there is no further grouping of data. Or in simple terms each row has one record and is being returned ordered by

Re: Sorting & pagination in apache cassandra 2.1

2016-01-12 Thread Jonathan Haddad
The clustering keys determine the sorting of rows within a partition. The partitions within a file are sorted by their token (usually computed by applying the murmur 3 hash to the partition key). If you are using a version of Cassandra < 3.0, you'll need to maintain your own materialized view

Re: Sorting & pagination in apache cassandra 2.1

2016-01-12 Thread anuja jain
I understand the meaning of SSTable but whats the reason behind sorting the table on the basis of int columns first.. Is there any data type preference in cassandra? Also What is the alternative to creating materialised views if my cassandra version is prior to 3.0 (specifically 2.1) and which is

Re: Sorting & pagination in apache cassandra 2.1

2016-01-12 Thread Carlos Alonso
Hi Anuja. Cassandra saves records on disk sorted by the clustering column. In this case you haven't selected any but it looks like is picking birth_year as the clustering column. I don't know which is the clustering column selection algorithm though (maybe alphabetically by name?). Regards

Re: Sorting & pagination in apache cassandra 2.1

2016-01-12 Thread Robert Coli
On Mon, Jan 11, 2016 at 11:30 PM, anuja jain wrote: > 1 more question, what does it mean by "cassandra inherently sorts data"? > SSTable = Sorted Strings Table. It doesn't contain "Strings" anymore, really, but that's a hint.. :) =Rob

Re: Sorting & pagination in apache cassandra 2.1

2016-01-11 Thread anuja jain
What is the alternative if my cassandra version is prior to 3.0 (specifically) 2.1) and which is already in production.? Also as per the docs given at https://docs.datastax.com/en/datastax_enterprise/4.6/datastax_enterprise/srch/srchCapazty.html what does it mean by we need to do capacity

Re: Sorting & pagination in apache cassandra 2.1

2016-01-11 Thread anuja jain
1 more question, what does it mean by "cassandra inherently sorts data"? For eg: I have a table with schema CREATE TABLE users ( ... user_name varchar PRIMARY KEY, ... password varchar, ... gender varchar, ... session_token varchar,

Sorting & pagination in apache cassandra 2.1

2016-01-07 Thread anuja jain
HI All, If suppose I have a cassandra table with structure CREATE TABLE test.t1 ( col1 text, col2 text, col3 text, col4 text, PRIMARY KEY (col1, col2, col3, col4) ) WITH CLUSTERING ORDER BY (col2 ASC, col3 ASC, col4 ASC); and it has following data col1 | col2 | col3 | col4

Re: Sorting & pagination in apache cassandra 2.1

2016-01-07 Thread Tyler Hobbs
On Thu, Jan 7, 2016 at 6:45 AM, anuja jain wrote: > My question is, what is the alternative if we need to order by col3 or > col4 in my above example without including col2 in order by clause. > The server-side alternative is to create a second table (or a materialized