You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Tyler Hobbs <ty...@datastax.com> on 2012/06/05 19:19:02 UTC

Re: [phpcassa] multi_get and composite, cassandra crash my mind

The Cassandra users mailing list is a better place for this question, so
I'm moving it there.

Some comments inline:

On Tue, Jun 5, 2012 at 6:47 AM, Juan Ezquerro LLanes <ar...@gmail.com>wrote:

> I have a columnfamily like:
>
> CREATE COLUMN FAMILY Watchdog
>     WITH key_validation_class =
> 'CompositeType(LexicalUUIDType,LexicalUUIDType)'
>     AND comparator = UTF8Type
>     AND column_metadata = [
>         {column_name: error_code, validation_class: UTF8Type, index_type:
> KEYS}
>         {column_name: line, validation_class: IntegerType}
>         {column_name: file_path, validation_class: UTF8Type}
>         {column_name: function, validation_class: UTF8Type}
>         {column_name: content, validation_class: UTF8Type}
>         {column_name: additional_data, validation_class: UTF8Type}
>         {column_name: date_created, validation_class: DateType,
> index_type: KEYS}
>         {column_name: priority, validation_class: IntegerType, index_type:
> KEYS}
>     ];
>
> Row key is a combo of 2 uuid, the first it's the user's uuid, if i want a
> select of all the watchdog entrys of a user.........how can i do? is it
> possible? I justk know user uuid, the other part of key is unknow uuid.
>
> The idea is simple, i have a user and i want all the records on watchdog,
> and i want secondary index to do search.........very simple with mysql but
> here i can't find the way.
>
> If i do with a supercolumn i can use secondary indexes, if key is
> composite there is no way for select all data related to a
> user...............
>

Don't use super columns.  You can't put secondary indexes on super column
families, anyways.


>
> The ugly way:
>
> CREATE COLUMN FAMILY Watchdog
>     WITH key_validation_class = LexicalUUIDType
>     AND comparator = UTF8Type
>     AND column_metadata = [
> *      {column_name: user_uuid, validation_class: LexicalUUIDType,
> index_type: KEYS}*
>         {column_name: error_code, validation_class: UTF8Type, index_type:
> KEYS}
>         {column_name: line, validation_class: IntegerType}
>         {column_name: file_path, validation_class: UTF8Type}
>         {column_name: function, validation_class: UTF8Type}
>         {column_name: content, validation_class: UTF8Type}
>         {column_name: additional_data, validation_class: UTF8Type}
>         {column_name: date_created, validation_class: DateType,
> index_type: KEYS}
>         {column_name: priority, validation_class: IntegerType, index_type:
> KEYS}
>     ];
>

I'm not sure why you think this is the ugly way to do it.  Assuming there
will be plenty of events for each user, this will work pretty well with a
secondary index.  Have you tried it?

The other decent option is to maintain your own index in a separate column
family with one row per user, similar to the "materialized view" approach
described here:
http://www.datastax.com/dev/blog/advanced-time-series-with-cassandra


>
> But i think that is not a nice solution because y always need to search in
> all rows of very big tables to take all user's data...............
>
> Please.... can help?
>
> Thanks.
>



-- 
Tyler Hobbs
DataStax <http://datastax.com/>

Re: [phpcassa] multi_get and composite, cassandra crash my mind

Posted by Tyler Hobbs <ty...@datastax.com>.
On Wed, Jun 6, 2012 at 2:49 AM, Juan Ezquerro LLanes <ar...@gmail.com>wrote:

>
>
> El martes, 5 de junio de 2012 19:19:02 UTC+2, Tyler Hobbs escribió:
>
>> The Cassandra users mailing list is a better place for this question, so
>> I'm moving it there.
>
>
> Hi, I need a phpcassa compatible solution ..... you think is better to
> move to the java world? :)
>

It should be doable in phpcassa either way; there's no limitation there.


>
>
>>
>> Some comments inline:
>>
>> On Tue, Jun 5, 2012 at 6:47 AM, Juan Ezquerro LLanes  wrote:
>>
>> I have a columnfamily like:
>>>
>>> CREATE COLUMN FAMILY Watchdog
>>>     WITH key_validation_class = 'CompositeType(**LexicalUUIDType,**
>>> LexicalUUIDType)'
>>>     AND comparator = UTF8Type
>>>     AND column_metadata = [
>>>         {column_name: error_code, validation_class: UTF8Type,
>>> index_type: KEYS}
>>>         {column_name: line, validation_class: IntegerType}
>>>         {column_name: file_path, validation_class: UTF8Type}
>>>         {column_name: function, validation_class: UTF8Type}
>>>         {column_name: content, validation_class: UTF8Type}
>>>         {column_name: additional_data, validation_class: UTF8Type}
>>>         {column_name: date_created, validation_class: DateType,
>>> index_type: KEYS}
>>>         {column_name: priority, validation_class: IntegerType,
>>> index_type: KEYS}
>>>     ];
>>>
>>> Row key is a combo of 2 uuid, the first it's the user's uuid, if i want
>>> a select of all the watchdog entrys of a user.........how can i do? is it
>>> possible? I justk know user uuid, the other part of key is unknow uuid.
>>>
>>> The idea is simple, i have a user and i want all the records on
>>> watchdog, and i want secondary index to do search.........very simple with
>>> mysql but here i can't find the way.
>>>
>>> If i do with a supercolumn i can use secondary indexes, if key is
>>> composite there is no way for select all data related to a
>>> user...............
>>>
>>
>> Don't use super columns.  You can't put secondary indexes on super column
>> families, anyways.
>>
>
> TYPO:  If i do with a supercolumn i can*'t* use secondary indexes .......
> :)
>
>
>>
>>>
>>> The ugly way:
>>>
>>> CREATE COLUMN FAMILY Watchdog
>>>     WITH key_validation_class = LexicalUUIDType
>>>     AND comparator = UTF8Type
>>>     AND column_metadata = [
>>> *      {column_name: user_uuid, validation_class: LexicalUUIDType,
>>> index_type: KEYS}*
>>>         {column_name: error_code, validation_class: UTF8Type,
>>> index_type: KEYS}
>>>         {column_name: line, validation_class: IntegerType}
>>>         {column_name: file_path, validation_class: UTF8Type}
>>>         {column_name: function, validation_class: UTF8Type}
>>>         {column_name: content, validation_class: UTF8Type}
>>>         {column_name: additional_data, validation_class: UTF8Type}
>>>         {column_name: date_created, validation_class: DateType,
>>> index_type: KEYS}
>>>         {column_name: priority, validation_class: IntegerType,
>>> index_type: KEYS}
>>>     ];
>>>
>>
>> I'm not sure why you think this is the ugly way to do it.  Assuming there
>> will be plenty of events for each user, this will work pretty well with a
>> secondary index.  Have you tried it?
>>
>>
> You think that's a good idea with very large sets of data, ok, you are the
> master, i try :)
>
> Thanks again :)
>
>
>> The other decent option is to maintain your own index in a separate
>> column family with one row per user, similar to the "materialized view"
>> approach described here: http://www.datastax.com/dev/**
>> blog/advanced-time-series-**with-cassandra<http://www.datastax.com/dev/blog/advanced-time-series-with-cassandra>
>>
>>
>>>
>>> But i think that is not a nice solution because y always need to search
>>> in all rows of very big tables to take all user's data...............
>>>
>>> Please.... can help?
>>>
>>> Thanks.
>>>
>>
>>
>>
>> --
>> Tyler Hobbs
>> DataStax <http://datastax.com/>
>>
>>
> El martes, 5 de junio de 2012 19:19:02 UTC+2, Tyler Hobbs escribió:
>
>> The Cassandra users mailing list is a better place for this question, so
>> I'm moving it there.
>>
>> Some comments inline:
>>
>> On Tue, Jun 5, 2012 at 6:47 AM, Juan Ezquerro LLanes <ar...@gmail.com>wrote:
>>
>>> I have a columnfamily like:
>>>
>>> CREATE COLUMN FAMILY Watchdog
>>>     WITH key_validation_class = 'CompositeType(**LexicalUUIDType,**
>>> LexicalUUIDType)'
>>>     AND comparator = UTF8Type
>>>     AND column_metadata = [
>>>         {column_name: error_code, validation_class: UTF8Type,
>>> index_type: KEYS}
>>>         {column_name: line, validation_class: IntegerType}
>>>         {column_name: file_path, validation_class: UTF8Type}
>>>         {column_name: function, validation_class: UTF8Type}
>>>         {column_name: content, validation_class: UTF8Type}
>>>         {column_name: additional_data, validation_class: UTF8Type}
>>>         {column_name: date_created, validation_class: DateType,
>>> index_type: KEYS}
>>>         {column_name: priority, validation_class: IntegerType,
>>> index_type: KEYS}
>>>     ];
>>>
>>> Row key is a combo of 2 uuid, the first it's the user's uuid, if i want
>>> a select of all the watchdog entrys of a user.........how can i do? is it
>>> possible? I justk know user uuid, the other part of key is unknow uuid.
>>>
>>> The idea is simple, i have a user and i want all the records on
>>> watchdog, and i want secondary index to do search.........very simple with
>>> mysql but here i can't find the way.
>>>
>>> If i do with a supercolumn i can use secondary indexes, if key is
>>> composite there is no way for select all data related to a
>>> user...............
>>>
>>
>> Don't use super columns.  You can't put secondary indexes on super column
>> families, anyways.
>>
>>
>>>
>>> The ugly way:
>>>
>>> CREATE COLUMN FAMILY Watchdog
>>>     WITH key_validation_class = LexicalUUIDType
>>>     AND comparator = UTF8Type
>>>     AND column_metadata = [
>>> *      {column_name: user_uuid, validation_class: LexicalUUIDType,
>>> index_type: KEYS}*
>>>         {column_name: error_code, validation_class: UTF8Type,
>>> index_type: KEYS}
>>>         {column_name: line, validation_class: IntegerType}
>>>         {column_name: file_path, validation_class: UTF8Type}
>>>         {column_name: function, validation_class: UTF8Type}
>>>         {column_name: content, validation_class: UTF8Type}
>>>         {column_name: additional_data, validation_class: UTF8Type}
>>>         {column_name: date_created, validation_class: DateType,
>>> index_type: KEYS}
>>>         {column_name: priority, validation_class: IntegerType,
>>> index_type: KEYS}
>>>     ];
>>>
>>
>> I'm not sure why you think this is the ugly way to do it.  Assuming there
>> will be plenty of events for each user, this will work pretty well with a
>> secondary index.  Have you tried it?
>>
>> The other decent option is to maintain your own index in a separate
>> column family with one row per user, similar to the "materialized view"
>> approach described here: http://www.datastax.com/dev/**
>> blog/advanced-time-series-**with-cassandra<http://www.datastax.com/dev/blog/advanced-time-series-with-cassandra>
>>
>>
>>>
>>> But i think that is not a nice solution because y always need to search
>>> in all rows of very big tables to take all user's data...............
>>>
>>> Please.... can help?
>>>
>>> Thanks.
>>>
>>
>>
>>
>> --
>> Tyler Hobbs
>> DataStax <http://datastax.com/>
>>
>>


-- 
Tyler Hobbs
DataStax <http://datastax.com/>