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 <arr...@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/>

Reply via email to