incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <sylv...@datastax.com>
Subject Re: slow read for cassandra time series
Date Thu, 30 May 2013 12:44:02 GMT
> I have a slow query that is making me think I don't understand the data
model for
> time series:
> select asset, returns from marketData where date >= 20130101 and date <=
20130110
> allow filtering;
>
> create table marketData {
> asset varchar,
> returns double,
> date timestamp,
> PRIMARY KEY(asset, date) }

You can only efficiently query a "time series" *within the same* partition
key in Cassandra.
In other words, the following works efficiently:
  SELECT returns FROM markerData WHERE asset='something' AND date >=
20130101 AND date <= 20130110

But it doesn't (work efficiently) if you don't specify a value of the
partition
key, i.e. asset in that case (Cassandra has to scan all your data to check
what
matches basically). Your cue should be the "ALLOW FILTERING" in your query.
The
fact that you *have to* add it for the query to work basically means "this
query will not be efficient".

--
Sylvain

Mime
View raw message