cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaron morton <aa...@thelastpickle.com>
Subject Re: Presentation, CQL 3 and Paging
Date Wed, 18 Jul 2012 04:07:55 GMT
> the data... basically each row will represent a country, and each column of a particular
row will represent the data of a single user. 
Almost. 
The first field in the composite primary key is the row key, the remaining fields are used
to prefix the column names. So each column will be a single column value for a single user.

> 1) Is there an approach to randomly getting a User? Right now I'm doing all this in the
receiving end... I retrieve all the corresponding Users and then select a random portion of
them.
Assuming your CF definition includes…

PRIMARY KEY (country, last_login_date, email)

You will need to know all three bits of information to get a single user. You may want to
also store the user details in  CF that is keyed on the user id / email.


> 2) Unless I'm missing something there's now way to page a query using CQL. Some of my
queries returns a high volume of data and I don't have enough RAM. Do I have to use the Thrift
API or are there other high level libraries which I could use (I'm using Ruby so I'm looking
into Twitter's Cassandra gem but I've not found yet a way to do this with it)

The only way to page is to provide a start column and get the next X columns. 

Cheers

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 18/07/2012, at 3:54 AM, Bruno Di Pentima wrote:

> Hello all!
> 
> I'm new to Cassandra and the list. Still learning and testing basic stuff. I've got a
couple of questions which I'm hoping you could help me with.
> 
> I'm currently using Cassandra 1.1.1 and CQL Spec 3. 
> 
> My schema consists of a table which represents a user list with with their according
properties (country, last_login_date, email, birthdate, name, etc). I've created a composite
key on the columns I always query (country and last_login_date  [plus email as the unique
part of the key]). If I understand correctly, this generates a wide row Columnfamily where
the partition key is the country and the remaining parts of the composite (last_login_date
and email) are used for clustering the data... basically each row will represent a country,
and each column of a particular row will represent the data of a single user. 
> What I need querying this Columnfamily is a random list of X users from Y country which
have logged in in the last Z months. So...
> 1) Is there an approach to randomly getting a User? Right now I'm doing all this in the
receiving end... I retrieve all the corresponding Users and then select a random portion of
them.
> 2) Unless I'm missing something there's now way to page a query using CQL. Some of my
queries returns a high volume of data and I don't have enough RAM. Do I have to use the Thrift
API or are there other high level libraries which I could use (I'm using Ruby so I'm looking
into Twitter's Cassandra gem but I've not found yet a way to do this with it)
> 
> Thanks in advance. Hope I made myself understood... English is not my primary language
:)
> 
> Best,
> 
> -- Bruno Di Pentima
> Santa Fe, Argentina
> 
> 
> 
> 


Mime
View raw message