You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Todd Fast <to...@conga.com> on 2012/01/26 08:36:19 UTC

Mixed random & ordered partitioning?

I want to do ranged row queries for a few of my column families, but 
best practice seems to be to use the random partitioner. Splitting my 
column families between two clusters (one random, one ordered) seems 
like a pretty expensive compromise.

Instead, I'm thinking of using the order-preserving partitioner in my 
cluster, but distributing load for most of my column families by hashing 
the row keys in my application code. Then, for the few column families 
which I need to slice rows, I can just use unhashed keys.

What is be the effective difference between hashing the keys myself and 
letting the random partitioner do it? Is this advisable?

Thanks,
Todd


Re: Mixed random & ordered partitioning?

Posted by aaron morton <aa...@thelastpickle.com>.
> What is be the effective difference between hashing the keys myself and letting the random partitioner do it?
This is what the RandomPartitioner calls
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java#L209

> Is this advisable?
I would try to avoid it. It's going to add to your code complexity and make it very hard to balance the cluster. 

Is building an index row an option ?

Cheers

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 26/01/2012, at 8:36 PM, Todd Fast wrote:

> I want to do ranged row queries for a few of my column families, but best practice seems to be to use the random partitioner. Splitting my column families between two clusters (one random, one ordered) seems like a pretty expensive compromise.
> 
> Instead, I'm thinking of using the order-preserving partitioner in my cluster, but distributing load for most of my column families by hashing the row keys in my application code. Then, for the few column families which I need to slice rows, I can just use unhashed keys.
> 
> What is be the effective difference between hashing the keys myself and letting the random partitioner do it? Is this advisable?
> 
> Thanks,
> Todd
>