Yes, indeed using the evil ordered partitioner it would work, but it should
be avoided at all costs.
What I am trying to figure is: Can I tell Cassandra is not good for cases
where you need range queries over all the cluster?
It's just a kind of "architectural rule" I am trying to use to decide
whether when to use a kind of technology or another.
Solr, for instance, allows you to query the way you want over all the
cluster, so data stax enterprise could "solve" this problem, but I wonder
if it's the only way.

[]s

2014-09-18 13:35 GMT-03:00 DuyHai Doan <doanduy...@gmail.com>:

> Your query "select * from testcf where key1 > 'Lucas';" does work if you
> choose the old OrderPartioner but since it's considered absolute evil (for
> good reason, load distribution is horrendous), pratically it is not
> possible to do your query.
>
> And it's the same thing with secondary index. Query with inequality on
> secondary index translates into full cluster scan...
>
> Regards
>
>  Duy Hai DOAN
>
> On Thu, Sep 18, 2014 at 5:44 PM, Marcelo Elias Del Valle <
> marc...@s1mbi0se.com.br> wrote:
>
>> Hi,
>>
>> This question is just for curiosity purposes, I don't need this in my
>> solution, but it's something I was asking myself...
>>
>> Is there a way of indexing the partition key values in Cassandra? Does
>> anyone needed this and found a solution of any kind?
>>
>> For example, I know the sample bellow doesn't work, but would it be
>> possible somehow?
>> I know select * from testcf where token(key1) > token('Lucas'); works,
>> but the question is ordering by the values, even using another CF or index
>> of any kind...
>>
>> CREATE KEYSPACE IF NOT EXISTS testks
>>   WITH REPLICATION = { 'class' : 'SimpleStrategy',
>>   'replication_factor': '1' };
>>
>>
>> CREATE TABLE IF NOT EXISTS testcf (
>>   key1 varchar,
>>   value varchar,
>>   PRIMARY KEY ((key1)));
>>
>> CREATE INDEX testidx on testks.testcf (key1);
>>
>> insert into testcf (key1, value) values ('Lucas', 'value1');
>> insert into testcf (key1, value) values ('Luiz', 'value2');
>> insert into testcf (key1, value) values ('Edu', 'value3');
>> insert into testcf (key1, value) values ('Marcelo', 'value4');
>>
>> select * from testcf order by key1;
>> select * from testcf where key1 > 'Lucas';
>>
>>
>> Best regards,
>> Marcelo.
>>
>
>

Reply via email to