On Wed, Jan 9, 2013 at 3:37 PM, <stephen.m.thomp...@wellsfargo.com> wrote:

> OK … I think I understand these.  So the idea is that you would use the
> time as the column key? ****
>
> ** **
>
> So when I might have something like this:****
>
> ** **
>
> <key1> | time=2013/01/03 08:19:01 | user=john | site=Chicago****
>
> <key2> | time=2013/01/05 01:55:34 | user=john | site=Chicago****
>
> <key3> | time=2013/01/09 16:21:42 | user=john | site=New York****
>
> <key4> | time=2013/01/09 17:27:41 | user=susan | site=Boston****
>
> <key5> | time=2013/01/09 17:27:41 | user=asok | site=Dallas****
>
> ** **
>
> Instead it would be better to do something like this:****
>
> ** **
>
> <key1> | 2013/01/03 08:19:01= {user=john, site=Chicago} | 2013/01/05
> 01:55:34={user=john, site=Chicago } | 2013/01/09 16:21:42={user=john,
> site=New York}****
>
> <key2> | time=2013/01/09 17:27:41 = {user=susan, site=Boston}****
>
> <key3> | time=2013/01/09 17:27:41={user=asok,site=Dallas}****
>
> ** **
>
> Am I understanding this correctly?
>

Yes, that appears to be roughly correct.  You have a few options for how
you choose your row keys, but the main point is that you're using some
representation of time for column names in order to sort the data by time.


>   This seems to have the HUGE disadvantage that I am no longer going to be
> able to create secondary indexes on *user* and *site*.  Is that right?  **
> **
>
> ** **
>
> This seems like an impossible solution for my requirements.
>

Yes, you will not be able to add built-in secondary indexes on those column
families.  Instead, you will denormalize and store the data a second time
in some other form that makes it easy to run queries based on "user" and
"site".  You could even keep your old column family alongside the new one
and add the secondary indexes on that.

Denormalization is typical for Cassandra as it allows you to optimize for
reads while only sacrificing extra disk space and a minor amount of write
overhead (writes are very cheap in Cassandra).

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

Reply via email to