incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Morton <aa...@thelastpickle.com>
Subject Re: Data Modelling Information
Date Thu, 12 Dec 2013 02:37:34 GMT
> create table messages(
> 	body text,
> 	username text,
> 	tags set<text>
> 	PRIMARY keys(username,tags)
> )

This statement is syntactically invalid, also you cannot use a collection type in the primary
key. 

> 1) I should be able to query by username and get all the messages for a particular username

yes. 

> 2) I should be able to query by tags and username ( likes select * from messages where
username='xya' and tags in ('awesome','phone'))
No.

> 3) I should be able to query all messages by day and  order by desc and limit to some
value
No.

> Could you guys please let me know if creating a secondary index on the tags field?

No, it’s not supported. 


> Or what would be the best way to model this data.

You need to describe the problem and how you want to read the data. I suggest taking a look
at the data modelling videos from Patrick here http://planetcassandra.org/Learn/CassandraCommunityWebinars

Cheers

-----------------
Aaron Morton
New Zealand
@aaronmorton

Co-Founder & Principal Consultant
Apache Cassandra Consulting
http://www.thelastpickle.com

On 10/12/2013, at 8:57 am, Shrikar archak <shrikar84@gmail.com> wrote:

> Hi Data Model Experts,
> I have a few questions with data modelling for a particular application.
> 
> example
> create table messages(
> 	body text,
> 	username text,
> 	tags set<text>
> 	PRIMARY keys(username,tags)
> )
> 
> 
> Requirements
> 1) I should be able to query by username and get all the messages for a particular username
> 2) I should be able to query by tags and username ( likes select * from messages where
username='xya' and tags in ('awesome','phone'))
> 3) I should be able to query all messages by day and  order by desc and limit to some
value
> 
> 
> Could you guys please let me know if creating a secondary index on the tags field?
> Or what would be the best way to model this data.
> 
> Thanks,
> Shrikar


Mime
View raw message