You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by aaron morton <aa...@thelastpickle.com> on 2012/06/01 03:24:25 UTC

Re: How can we use composite indexes and secondary indexes together

If you want to do arbitrary complex online / realtime queries look at Data Stax Enterprise, or https://github.com/tjake/Solandra or straight Solr. 

Alternatively denormalise the model to materialise the results when you insert so you query is a straight lookup. Or do some client side filtering / aggregation. 

If you want to do the queries offline, you can use Pig or Hive with Hadoop over Cassandra. The Apache Cassandra distro includes the pig support, hive is coming (i think) and there are Hadoop interfaces.  You can also look at Data Stax Enterprise. 

 
Cheers

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

On 31/05/2012, at 11:07 PM, Nury Redjepow wrote:

> We want to use cassandra to store complex data. But we can't figure out, how to organize indexes.
> 
> Our table (column family) looks like this:
> 
> Users = { RandomId int, Firstname varchar, Lastname varchar, Age int, Country int, ChildCount int }
> 
> In our queries we have mandatory fields (Firstname,Lastname,Age) and extra search options (Country,ChildCount). How do we organize index to make this kind of queries fast?
> 
> First I thought, it would be natural to make composite index on (Firstname,Lastname,Age) and add separate secondary index on remaining fields (Country and ChildCount). But I can't insert rows into table after creating secondary indexes. And also, I can't query the table.
> 
> I'm using cassandra 1.1.0, and cqlsh with --cql3 option.
> 
> Any other suggestions to solve our problem (complex queries with mandatory and additional options) are welcome.
> 
> The main point is, how can we join data in cassandra. If I make few index column families, I need to intersect the values, to get rows that pass all search criteria??? Or should I use something based on Hadoop (Pig,Hive) to make such queries?
> 
> Respectfully, Nury
> 
> 
> 
> 


Re: How can we use composite indexes and secondary indexes together

Posted by Vivek Mishra <mi...@gmail.com>.
Have a look at Kundera (https://github.com/impetus-opensource/Kundera). It
does provide some sort of support (using Lucene) and allow you to deal with
association in JPA way.

-Vivek

On Fri, Jun 1, 2012 at 6:54 AM, aaron morton <aa...@thelastpickle.com>wrote:

> If you want to do arbitrary complex online / realtime queries look at Data
> Stax Enterprise, or https://github.com/tjake/Solandra or straight Solr.
>
> Alternatively denormalise the model to materialise the results when you
> insert so you query is a straight lookup. Or do some client side filtering
> / aggregation.
>
> If you want to do the queries offline, you can use Pig or Hive with Hadoop
> over Cassandra. The Apache Cassandra distro includes the pig support, hive
> is coming (i think) and there are Hadoop interfaces.  You can also look at
> Data Stax Enterprise.
>
>
> Cheers
>
> -----------------
> Aaron Morton
> Freelance Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 31/05/2012, at 11:07 PM, Nury Redjepow wrote:
>
> We want to use cassandra to store complex data. But we can't figure out,
> how to organize indexes.
>
> Our table (column family) looks like this:
>
> Users = { RandomId int, Firstname varchar, Lastname varchar, Age int,
> Country int, ChildCount int }
>
> In our queries we have mandatory fields (Firstname,Lastname,Age) and extra
> search options (Country,ChildCount). How do we organize index to make this
> kind of queries fast?
>
> First I thought, it would be natural to make composite index on
> (Firstname,Lastname,Age) and add separate secondary index on remaining
> fields (Country and ChildCount). But I can't insert rows into table after
> creating secondary indexes. And also, I can't query the table.
>
> I'm using cassandra 1.1.0, and cqlsh with --cql3 option.
>
> Any other suggestions to solve our problem (complex queries with mandatory
> and additional options) are welcome.
> The main point is, how can we join data in cassandra. If I make few index
> column families, I need to intersect the values, to get rows that pass all
> search criteria??? Or should I use something based on Hadoop (Pig,Hive) to
> make such queries?
>
> Respectfully, Nury
>
> ------------------------------
>
> ------------------------------
>
> ------------------------------
>
> ------------------------------
>
>
>