cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <sylv...@datastax.com>
Subject Re: Request Timeout with Composite Columns and CQL3
Date Tue, 26 Jun 2012 08:21:00 GMT
On Mon, Jun 25, 2012 at 11:10 PM, Henning Kropp <Kropp@nurago.com> wrote:
> Hi,
>
> I am running into timeout issues using composite columns in cassandra 1.1.1
> and cql 3.
>
> My keyspace and table is defined as the following:
>
> create keyspace bn_logs
>     with strategy_options = [{replication_factor:1}]
>     and placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy';
>
> CREATE TABLE logs (
>   id text,
>   ref text,
>   time bigint,
>   datum text,
>   PRIMARY KEY(id, ref, time)
> );
>
> I import some data to the table by using a combination of the thrift
> interface and the hector Composite.class by using its serialization as the
> column name:
>
> Column col = new Column(composite.serialize());
>
> This all seems to work fine until I try to execute the following query which
> leads to a request timeout:
>
> SELECT datum FROM logs WHERE id='861' and ref = 'raaf' and time > '3000';

If it timeouts the likely reason is that this query selects more data
than the machine is able to fetch before the timeout. You can either
add a limit to the query, or increase the timeout.
If that doesn't seem to fix it, it might be worth checking the server
log to see if there isn't an error.

> I really would like to figure out, why running this query on my laptop
> (single node, for development) will not finish. I also would like to know if
> the following query would actually work
>
> SELECT datum FROM logs WHERE id='861' and ref = 'raaf*' and time > '3000';

It won't. You can perform the following query:

SELECT datum FROM logs WHERE id='861' and ref = 'raaf';

which will select every datum whose ref starts with 'raaf', but then
you cannot restrict
the time parameter, so you will get ref where the time is <= 3000. Of
course you can
always filter client side if that is an option.

> or how else there is a way to define a range for the second component of the
> column key?

As described above, you can define a range on the second component, but then you
won't be able to restrict on the 3rd component.

>
> Any thoughts?
>
> Thanks in advance and kind regards
> Henning
>

Mime
View raw message