incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petter von Dolwitz (Hem)" <petter.von.dolw...@gmail.com>
Subject Re: Problems using secondary index with IN keyword
Date Thu, 24 Oct 2013 13:13:22 GMT
>You cannot use a part in a where clause unless you specify the preceeding
parts also.
But the statement SELECT * FROM mytable WHERE c='myvalue'; works?

What are secondary indexes for then if you can't use them in this way?

Forgot to mention that I am on Cassandra 2.0.1

/Petter


2013/10/24 Jan Algermissen <jan.algermissen@nordsc.com>

> Petter,
>
> On 24.10.2013, at 14:38, Petter von Dolwitz (Hem) <
> petter.von.dolwitz@gmail.com> wrote:
>
> > Hi,
> >
> > I have a table that (in simplified version) looks like this:
> >
> > CREATE TABLE mytable (
> >   a varchar,
> >   b varchar,
> >   c varchar
> >   d timstamp,
> >   e varchar,
> >   PRIMARY KEY (a, b, c, d)
> > );
> >
> > CREATE INDEX mytable_c_idx ON mytable ( c );
> >
> > After populating I execute:
> >
> > SELECT * FROM mytable WHERE c='myvalue';
> >
> > which works fine. However, using:
> >
> > SELECT * FROM mytable WHERE c IN ('myvalue');
> >
> > gives me:
> > Bad Request: PRIMARY KEY part c cannot be restricted (preceding part b
> is either not restricted or by a non-EQ relation)
> >
> > Can anybody explain this?
>
> You cannot use a part in a where clause unless you specify the preceeding
> parts also.
>
> Think of it this way: To resolve yur restriction, C* would have to do a
> full scan over all rows to find those rows that have a 'myvalue' C-part.
>
> Jan
>
>
> > My aim is to query for more than one value in the c column. Is this
> supported?
> >
> > Thanks,
> > Petter
> >
> >
> >
> >
> >
>
>

Mime
View raw message