You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Franc Carter <fr...@sirca.org.au> on 2012/02/24 03:36:05 UTC

data model advice

Hi,

I've finished my first model and experiments with Cassandra with result I'm
pretty happy with - so I thought I'd move on to something harder.

We have a set of data that has a large number of entities (which is our
primary search key), for each of the entities we have a smallish (<100)
number of sets of data. Each set has a further set the contains column/vale
pairs.

The queries will be for an Entity, for one or more days for one or more of
the subsets. Conceptually I would like to model like it like this:-

Entity {
   Day1: {
       TypeA: {col1:val1, col2:val2, . . . }
       TypeB: {col1:val1, col3:val3, . . . }
          .
          .
   }
   .
   .
   .
   DayN: {
       TypeB: {col3:val3, col5:val5, . . . }
       TypeD: {col3:val3, col6:val6, . . . }
          .
          .
   }
}

My understanding of the Cassandra data model is that I run out of map-dept
to do this in my simplistic approach as the Days are super columns, the
types are column and then I don't have a col/val map left for data.

Does anyone have advice on a good approach ?

thanks

-- 

*Franc Carter* | Systems architect | Sirca Ltd
 <ma...@sirca.org.au>

franc.carter@sirca.org.au | www.sirca.org.au

Tel: +61 2 9236 9118

Level 9, 80 Clarence St, Sydney NSW 2000

PO Box H58, Australia Square, Sydney NSW 1215

Re: data model advice

Posted by Franc Carter <fr...@sirca.org.au>.
On Fri, Feb 24, 2012 at 2:54 PM, Martin Arrowsmith <
arrowsmith.martin@gmail.com> wrote:

> Hi Franc,
>
> Or, you can consider using composite columns. It is not recommended to use
> Super Columns anymore.
>

Thanks,

I'll look in to composite columns

cheers


>
> Best wishes,
>
> Martin
>
>
> On Thu, Feb 23, 2012 at 7:51 PM, Indranath Ghosh <in...@gmail.com>wrote:
>
>> How about using a composite row key like the following:
>>
>> Entity.Day1.TypeA: {col1:val1, col2:val2, . . . }
>> Entity.Day1.TypeB: {col1:val1, col2:val2, . . . }
>> .
>> .
>> Entity.DayN.TypeA: {col1:val1, col2:val2, . . . }
>> Entity.DayN.TypeB: {col1:val1, col2:val2, . . . }
>>
>> It is better to avoid super columns..
>>
>> -indra
>>
>> On Thu, Feb 23, 2012 at 6:36 PM, Franc Carter <fr...@sirca.org.au>wrote:
>>
>>>
>>> Hi,
>>>
>>> I've finished my first model and experiments with Cassandra with result
>>> I'm pretty happy with - so I thought I'd move on to something harder.
>>>
>>> We have a set of data that has a large number of entities (which is our
>>> primary search key), for each of the entities we have a smallish (<100)
>>> number of sets of data. Each set has a further set the contains column/vale
>>> pairs.
>>>
>>> The queries will be for an Entity, for one or more days for one or more
>>> of the subsets. Conceptually I would like to model like it like this:-
>>>
>>> Entity {
>>>    Day1: {
>>>        TypeA: {col1:val1, col2:val2, . . . }
>>>        TypeB: {col1:val1, col3:val3, . . . }
>>>           .
>>>           .
>>>    }
>>>    .
>>>    .
>>>    .
>>>    DayN: {
>>>        TypeB: {col3:val3, col5:val5, . . . }
>>>        TypeD: {col3:val3, col6:val6, . . . }
>>>           .
>>>           .
>>>    }
>>> }
>>>
>>> My understanding of the Cassandra data model is that I run out of
>>> map-dept to do this in my simplistic approach as the Days are super
>>> columns, the types are column and then I don't have a col/val map left for
>>> data.
>>>
>>> Does anyone have advice on a good approach ?
>>>
>>> thanks
>>>
>>> --
>>>
>>> *Franc Carter* | Systems architect | Sirca Ltd
>>>  <ma...@sirca.org.au>
>>>
>>> franc.carter@sirca.org.au | www.sirca.org.au
>>>
>>> Tel: +61 2 9236 9118
>>>
>>> Level 9, 80 Clarence St, Sydney NSW 2000
>>>
>>> PO Box H58, Australia Square, Sydney NSW 1215
>>>
>>>
>>
>>
>> --
>> *Indranath Ghosh
>> Phone: 408-813-9207*
>>
>>
>


-- 

*Franc Carter* | Systems architect | Sirca Ltd
 <ma...@sirca.org.au>

franc.carter@sirca.org.au | www.sirca.org.au

Tel: +61 2 9236 9118

Level 9, 80 Clarence St, Sydney NSW 2000

PO Box H58, Australia Square, Sydney NSW 1215

Re: data model advice

Posted by Brandon Williams <dr...@gmail.com>.
On Fri, Feb 24, 2012 at 10:46 AM, David Leimbach <le...@gmail.com> wrote:
>
>
> On Thu, Feb 23, 2012 at 7:54 PM, Martin Arrowsmith
> <ar...@gmail.com> wrote:
>>
>> Hi Franc,
>>
>> Or, you can consider using composite columns. It is not recommended to use
>> Super Columns anymore.
>
>
> Yes, but why?  Is it because composite columns effectively replace and
> simplify similar models?

http://www.quora.com/Cassandra-database/Why-is-it-bad-to-use-supercolumns-in-Cassandra

-Brandon

Re: data model advice

Posted by David Leimbach <le...@gmail.com>.
On Thu, Feb 23, 2012 at 7:54 PM, Martin Arrowsmith <
arrowsmith.martin@gmail.com> wrote:

> Hi Franc,
>
> Or, you can consider using composite columns. It is not recommended to use
> Super Columns anymore.
>

Yes, but why?  Is it because composite columns effectively replace and
simplify similar models?

Re: data model advice

Posted by Franc Carter <fr...@sirca.org.au>.
On Fri, Feb 24, 2012 at 2:54 PM, Martin Arrowsmith <
arrowsmith.martin@gmail.com> wrote:

> Hi Franc,
>
> Or, you can consider using composite columns. It is not recommended to use
> Super Columns anymore.
>
> Best wishes,
>

On first read it would seem that there is fair bit of overhead with
composite columns as it's my understanding that the column name is stored
with each value - or have I missed something ?

cheers


>
> Martin
>
>
> On Thu, Feb 23, 2012 at 7:51 PM, Indranath Ghosh <in...@gmail.com>wrote:
>
>> How about using a composite row key like the following:
>>
>> Entity.Day1.TypeA: {col1:val1, col2:val2, . . . }
>> Entity.Day1.TypeB: {col1:val1, col2:val2, . . . }
>> .
>> .
>> Entity.DayN.TypeA: {col1:val1, col2:val2, . . . }
>> Entity.DayN.TypeB: {col1:val1, col2:val2, . . . }
>>
>> It is better to avoid super columns..
>>
>> -indra
>>
>> On Thu, Feb 23, 2012 at 6:36 PM, Franc Carter <fr...@sirca.org.au>wrote:
>>
>>>
>>> Hi,
>>>
>>> I've finished my first model and experiments with Cassandra with result
>>> I'm pretty happy with - so I thought I'd move on to something harder.
>>>
>>> We have a set of data that has a large number of entities (which is our
>>> primary search key), for each of the entities we have a smallish (<100)
>>> number of sets of data. Each set has a further set the contains column/vale
>>> pairs.
>>>
>>> The queries will be for an Entity, for one or more days for one or more
>>> of the subsets. Conceptually I would like to model like it like this:-
>>>
>>> Entity {
>>>    Day1: {
>>>        TypeA: {col1:val1, col2:val2, . . . }
>>>        TypeB: {col1:val1, col3:val3, . . . }
>>>           .
>>>           .
>>>    }
>>>    .
>>>    .
>>>    .
>>>    DayN: {
>>>        TypeB: {col3:val3, col5:val5, . . . }
>>>        TypeD: {col3:val3, col6:val6, . . . }
>>>           .
>>>           .
>>>    }
>>> }
>>>
>>> My understanding of the Cassandra data model is that I run out of
>>> map-dept to do this in my simplistic approach as the Days are super
>>> columns, the types are column and then I don't have a col/val map left for
>>> data.
>>>
>>> Does anyone have advice on a good approach ?
>>>
>>> thanks
>>>
>>> --
>>>
>>> *Franc Carter* | Systems architect | Sirca Ltd
>>>  <ma...@sirca.org.au>
>>>
>>> franc.carter@sirca.org.au | www.sirca.org.au
>>>
>>> Tel: +61 2 9236 9118
>>>
>>> Level 9, 80 Clarence St, Sydney NSW 2000
>>>
>>> PO Box H58, Australia Square, Sydney NSW 1215
>>>
>>>
>>
>>
>> --
>> *Indranath Ghosh
>> Phone: 408-813-9207*
>>
>>
>


-- 

*Franc Carter* | Systems architect | Sirca Ltd
 <ma...@sirca.org.au>

franc.carter@sirca.org.au | www.sirca.org.au

Tel: +61 2 9236 9118

Level 9, 80 Clarence St, Sydney NSW 2000

PO Box H58, Australia Square, Sydney NSW 1215

Re: data model advice

Posted by Martin Arrowsmith <ar...@gmail.com>.
Hi Franc,

Or, you can consider using composite columns. It is not recommended to use
Super Columns anymore.

Best wishes,

Martin

On Thu, Feb 23, 2012 at 7:51 PM, Indranath Ghosh <in...@gmail.com>wrote:

> How about using a composite row key like the following:
>
> Entity.Day1.TypeA: {col1:val1, col2:val2, . . . }
> Entity.Day1.TypeB: {col1:val1, col2:val2, . . . }
> .
> .
> Entity.DayN.TypeA: {col1:val1, col2:val2, . . . }
> Entity.DayN.TypeB: {col1:val1, col2:val2, . . . }
>
> It is better to avoid super columns..
>
> -indra
>
> On Thu, Feb 23, 2012 at 6:36 PM, Franc Carter <fr...@sirca.org.au>wrote:
>
>>
>> Hi,
>>
>> I've finished my first model and experiments with Cassandra with result
>> I'm pretty happy with - so I thought I'd move on to something harder.
>>
>> We have a set of data that has a large number of entities (which is our
>> primary search key), for each of the entities we have a smallish (<100)
>> number of sets of data. Each set has a further set the contains column/vale
>> pairs.
>>
>> The queries will be for an Entity, for one or more days for one or more
>> of the subsets. Conceptually I would like to model like it like this:-
>>
>> Entity {
>>    Day1: {
>>        TypeA: {col1:val1, col2:val2, . . . }
>>        TypeB: {col1:val1, col3:val3, . . . }
>>           .
>>           .
>>    }
>>    .
>>    .
>>    .
>>    DayN: {
>>        TypeB: {col3:val3, col5:val5, . . . }
>>        TypeD: {col3:val3, col6:val6, . . . }
>>           .
>>           .
>>    }
>> }
>>
>> My understanding of the Cassandra data model is that I run out of
>> map-dept to do this in my simplistic approach as the Days are super
>> columns, the types are column and then I don't have a col/val map left for
>> data.
>>
>> Does anyone have advice on a good approach ?
>>
>> thanks
>>
>> --
>>
>> *Franc Carter* | Systems architect | Sirca Ltd
>>  <ma...@sirca.org.au>
>>
>> franc.carter@sirca.org.au | www.sirca.org.au
>>
>> Tel: +61 2 9236 9118
>>
>> Level 9, 80 Clarence St, Sydney NSW 2000
>>
>> PO Box H58, Australia Square, Sydney NSW 1215
>>
>>
>
>
> --
> *Indranath Ghosh
> Phone: 408-813-9207*
>
>

Re: data model advice

Posted by Indranath Ghosh <in...@gmail.com>.
How about using a composite row key like the following:

Entity.Day1.TypeA: {col1:val1, col2:val2, . . . }
Entity.Day1.TypeB: {col1:val1, col2:val2, . . . }
.
.
Entity.DayN.TypeA: {col1:val1, col2:val2, . . . }
Entity.DayN.TypeB: {col1:val1, col2:val2, . . . }

It is better to avoid super columns..

-indra

On Thu, Feb 23, 2012 at 6:36 PM, Franc Carter <fr...@sirca.org.au>wrote:

>
> Hi,
>
> I've finished my first model and experiments with Cassandra with result
> I'm pretty happy with - so I thought I'd move on to something harder.
>
> We have a set of data that has a large number of entities (which is our
> primary search key), for each of the entities we have a smallish (<100)
> number of sets of data. Each set has a further set the contains column/vale
> pairs.
>
> The queries will be for an Entity, for one or more days for one or more of
> the subsets. Conceptually I would like to model like it like this:-
>
> Entity {
>    Day1: {
>        TypeA: {col1:val1, col2:val2, . . . }
>        TypeB: {col1:val1, col3:val3, . . . }
>           .
>           .
>    }
>    .
>    .
>    .
>    DayN: {
>        TypeB: {col3:val3, col5:val5, . . . }
>        TypeD: {col3:val3, col6:val6, . . . }
>           .
>           .
>    }
> }
>
> My understanding of the Cassandra data model is that I run out of map-dept
> to do this in my simplistic approach as the Days are super columns, the
> types are column and then I don't have a col/val map left for data.
>
> Does anyone have advice on a good approach ?
>
> thanks
>
> --
>
> *Franc Carter* | Systems architect | Sirca Ltd
>  <ma...@sirca.org.au>
>
> franc.carter@sirca.org.au | www.sirca.org.au
>
> Tel: +61 2 9236 9118
>
> Level 9, 80 Clarence St, Sydney NSW 2000
>
> PO Box H58, Australia Square, Sydney NSW 1215
>
>


-- 
*Indranath Ghosh
Phone: 408-813-9207*