incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: schema design question
Date Wed, 10 Mar 2010 17:15:30 GMT
if you want to select stuff out w/ one query, then single CF is the
only sane choice

if not then 2 CFs may be more performant

On Wed, Mar 10, 2010 at 4:42 AM, Matteo Caprari
<matteo.caprari@gmail.com> wrote:
> I can't quite decide if to go with a flat schema, with keys repeated
> in different CFs
> or have one CF with nested supercolumns.
>
> I guess there is no straight answer here,  but what's a good reasoning
> about the choice?
>
> This two mutation maps should clarify my dillemma:
>
> deep_mutation_map = {
>        'example_item': {
>                'Items': [
>                        Mutation(SuperColumn('details', [
>                                Column('title', 'an article'),
>                                Column('link', 'www.example.com')
>                        ])),
>                        Mutation(SuperColumn('likers', [
>                                Column('user_1', 'xx'),
>                                Column('user_2', 'xx')
>                        ]))
>                ]
>        }
> }
>
> flat_mutation_map = {
>        'example_item': {
>                'Item_Info': [
>                        Mutation(Column('title', 'an_article')),
>                        Mutation(Column('link', 'www.example.com')),
>                ],
>                'Item_likers': [
>                        Mutation(Column('user_1', 'xx')),
>                        Mutation(Column('user_2', 'xx'))
>                ]
>        }
> }
>
>
> On Tue, Mar 9, 2010 at 7:33 PM, Jonathan Ellis <jbellis@gmail.com> wrote:
>> On Tue, Mar 9, 2010 at 7:30 AM, Matteo Caprari <matteo.caprari@gmail.com> wrote:
>>> On Tue, Mar 9, 2010 at 1:23 PM, Jonathan Ellis <jbellis@gmail.com> wrote:
>>>> That's true.  So you'd want to use a custom comparator where first 64
>>>> bits is the Long and the rest is the userid, for instance.
>>>>
>>>> (Long + something else is common enough that we might want to add it
>>>> to the defaults...)
>>>
>>> What about using a SuperColumn for each like-count and then the list
>>> of users that hit that level?
>>
>> That would also work, it's just a little clunky pulling things out of
>> a nested structure when really you want a flat list.  But if you are
>> allergic to Java that is the way to go so you don't have to write a
>> custom AbstractType subclass. :)
>>
>> -Jonathan
>>
>
>
>
> --
> :Matteo Caprari
> matteo.caprari@gmail.com
>

Mime
View raw message