cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tyler Hobbs <ty...@riptano.com>
Subject Re: partial matching of keys
Date Tue, 30 Nov 2010 07:22:26 GMT
Yes, you can basically do this two ways:

First, you can use an OrderPreservingPartitioner.  This stores your keys in
order, so you can grab the range of keys that begin with 'A|B'.  Because of
the drawbacks of OPP (unbalanced ring, hotspots), you almost certainly don't
want to do this.

Second, you take advantage of column name sorting.  For example, you can
have a row for all of the calls that A has made; each column name can be
something like 'B|T'. This allows you to quickly get all of the times when A
called
B in chronological order.  (You can have a second row or column family and
swap B
and T's position if you're more interested in time slices.)  This is very
much like the
Twitter clone, Twissandra:

https://github.com/ericflo/twissandra
http://twissandra.com/

As for examples, there are Hector examples here:

https://github.com/zznate/hector-examples

- Tyler

On Tue, Nov 30, 2010 at 12:11 AM, Arijit Mukherjee <arijit72@gmail.com>wrote:

> Hi All
>
> I was wondering if it is possible to match keys partially while
> searching in Cassandra.
>
> I have a requirement where I'm storing a large number of records, the
> key being something like "A|B|T" where A and B are mobile numbers and
> T is the time-stamp (the time when A called B). Such format ensure the
> uniqueness of the keys. Now if I want to search for all records where
> A called B, I would like to do a partial match with "A|B". Is this
> possible?
>
> I've another small question - where can I find some complete examples
> of creating a cluster and communicating with it (for
> insertion/deletion of records) using Hector or Pelops? So far, I've
> been doing this via the Thrift interface, but it's becoming illegible
> now...
>
> Thanks in advance...
>
> Regards
> Arijit
>
> --
> "And when the night is cloudy,
> There is still a light that shines on me,
> Shine on until tomorrow, let it be."
>

Mime
View raw message