>> 1) Is it possible to design to get equivalent results for above
>> query ( using CQL or Hector) with Cassandra.
If this is a common query in your app it's god idea to design the data model to 
support the request. Seems safe to assume  the PK in your example is non 
unique, I'll call it the FKID below and use PKID as a unique id for the entity

Relational Model:
PKID int (unique)
FKID int (non unique)
other_attribute int (non unique)

CF: AttributeIndex
row key: FKID
column name: CompositeType(attr_value:IntegerType, pkid:IntegerType)
column value: nothing 

You would then do a SliceRange over the rows. 

For a more detailed look check out this presentation from Ed Anuff at the 
Cassandra SF conference http://www.slideshare.net/edanuff/indexing-in-cassandra

Cheers

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

On 11 Aug 2011, at 23:06, Benoit Perroud wrote:

> You can apply this query really simply using cassandra and secondary indexes.
> 
> You will have a CF "TABLE", where row keys are your PK. Just to be sure of my 
> understanding, your SQL query will either return 1 row or no row, right ?
> 
> 3) SliceQuery returns a range of columns for a given key, it may be your 
> friend.
> 
> 
> 
> 
> 
> On 11. 08. 11 07:50, a...@9y.com wrote:
>> I recently started with Cassandra and found interesting.
>> 
>> I was curious in SQL we have
>> 
>> SELECT * from TABLE where PK="primary_key" and other_attribute
>> between 500 and 1000;
>> 
>> My questions are :
>> 1) Is it possible to design to get equivalent results for above
>> query ( using CQL or Hector) with Cassandra.
>> 
>> 2) How can we design CF in that case? Using secondary index is an
>> option but I am not clear how that can be applied here.
>> 
>> 3) Is there any way we can have a range slice over columns names
>> instead of having range or row keys.
>> 
>> I am just a novice. So, Can anyone help me with these question
>> 

Reply via email to