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 Suggestions
Date Fri, 24 Aug 2012 10:26:24 GMT
> I was trying to find hector examples where we search for second column in a composite
column, but I couldn't find any good one. Im not sure if its possible.…if you have any do
have any example please share.
It's not. When slicing columns you can only return one contiguous range. 

> Anyway I would prefer storing the item-ids as column names in the main column family
and having a second CF for the order-by-date query only with the pair timestamp_itemid. That
way you can add later other query strategies without messing with how you store the item 
+1
Have the orders somewhere, and build a time ordered custom index to show them in order. 

Cheers

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

On 24/08/2012, at 6:28 AM, Guillermo Winkler <gwinkler@inconcertcc.com> wrote:

> I think you need another CF as index.
> 
> user_itemid -> timestamped column_name
> 
> Otherwise you can't guess what's the timestamp to use in the column name.
> 
> Anyway I would prefer storing the item-ids as column names in the main column family
and having a second CF for the order-by-date query only with the pair timestamp_itemid. That
way you can add later other query strategies without messing with how you store the item information.
> 
> Maybe you can solve it with a secondary index by timestamp too.
> 
> Guille
> 
> 
> On Thu, Aug 23, 2012 at 7:26 AM, Roshni Rajagopal <Roshni.Rajagopal@wal-mart.com>
wrote:
> Hi,
> 
> Need some help on a data modelling question. We're using Hector & Datastax Enterprise
2.1.
> 
> 
> I want to associate a list of items for a user. It should be sorted on the time added.
And items can be updated (quantity of the item can be changed), and items can be deleted.
> I can model it like this so that its denormalized and I get all my information in one
go from one row, sorted by time added. I can use composite columns.
> 
> Row key: User Id
> Column Name: TimeUUID:item ID: Item Name: Item Description: Item Price: Item Qty
> Column Value : Null
> 
> Now, how do I handle manipulations
> 
>  1.  Add new item :Easy , just a new column
>  2.  Add exiting item or modify qty: I want to get to the correct column to update .
Can I search by second column in the composite column (equals condition) & update the
column name itself to reflect new TimeUUID and qty?  Or would it be better to just add it
as a new column and always use the latest column for an item in the application code and delete
duplicates in the background.
>  3.  Delete item: Can I search by second column in the composite column to find the correct
column to delete?
> 
> I was trying to find hector examples where we search for second column in a composite
column, but I couldn't find any good one. Im not sure if its possible.…if you have any do
have any example please share.
> 
> Regards,
> Roshni
> 
> 
> This email and any files transmitted with it are confidential and intended solely for
the individual or entity to whom they are addressed. If you have received this email in error
destroy it immediately. *** Walmart Confidential ***
> 


Mime
View raw message