views:

199

answers:

2

I'm fairly new to Apache Cassandra and nosql in general.

In SQL I can do aggregate operations like:

SELECT 
  country, sum(age) / count(*) AS averageAge 
FROM people 
GROUP BY country;

This is nice because it is calculated within the DB, rather than having to move every row in the 'people' table into the client layer to do the calculation.

Is this possible in Apache Cassandra? How?

+1  A: 

Using SliceRange could be thought of as Cassandra's version of LIMIT and ORDER BY.

GROUP BY, COUNT and SUM is not supported out of the box.

Taking a look at the API page from the wiki is a good start.

Schildmeijer
+1  A: 

Cassandra is primarily a mechanism that supports fast writes and look-ups. There is no support for calculations like aggregates in SQL since it is not designed for that. I would suggest reading of popular Cassandra use-cases to get a better insight :) I have bookmarked some articles on my delicious page. Here is the link:

http://delicious.com/vibhutesagar/cassandra

Sagar V