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