i would respectfully disagree, what you have said is true but it really depends on the use case.

1) do you expect to be doing updates to individual fields of an item, or will you always update all fields at once? if you are doing separate updates then the first is definitely easier to handle updates. 2) do you expect to do paging of the list? this will be easier with the json approach, as in the first your item may span across a page boundary - not an insurmountable problem by any means, but more complicated nonetheless. this is not
an issue obviously if all your items have the same number of fields.
3) do you expect to read or delete multiple items individually? you may have to do multiple reads/deletes of a row if the items are not adjacent to each other as you cannot do 'disjoint' slices of columns at the moment. with the json approach you can just specify individual columns and you're done. again this is less of an issue if items have a known set of fields, but your list of columns to read/delete may get quite large fairly quickly

the first is definitely better if you want to update individual fields, read-then-write is not a good idea in cassandra. but it is more complicated for most usage scenarios, so you have to work out if you really need the extra flexibility.

On 24/08/2012 13:54, samal wrote:
First is better choice, each filed can be updated separately(write only).
Second you have to take care json yourself (read first-modify-then write).

On Fri, Aug 24, 2012 at 5:45 PM, Roshni Rajagopal <roshni.rajago...@wal-mart.com <mailto:roshni.rajago...@wal-mart.com>> wrote:

    Hi,

    Suppose I have a column family to associate a user to a dynamic
    list of items. I want to store 5-10 key  information about the
    item, & no specific sorting requirements are there.
    I have two options

    A) use composite columns
    UserId1 : {
     <itemid1>:<Name> = Betty Crocker,
     <itemid1>:<Descr> = Cake
    <itemid1>:<Qty> = 5
     <itemid2>:<Name> = Nutella,
     <itemid2>:<Descr> = Choc spread
    <itemid2>:<Qty> = 15
    }

    B) use a json with the data
    UserId1 : {
     <itemid1> = {name: Betty Crocker,descr: Cake, Qty: 5},
     <itemid2> ={name: Nutella,descr: Choc spread, Qty: 15}
    }

    Which do you suggest would be better?


    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 ***



Reply via email to