cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <sylv...@datastax.com>
Subject Re: Dynamic CF
Date Tue, 10 Jul 2012 12:23:35 GMT
On Fri, Jul 6, 2012 at 10:49 PM, Leonid Ilyevsky
<lilyevsky@mooncapital.com> wrote:
> At this point I am really confused about what direction Cassandra is going. CQL 3 has
the benefit of composite keys, but no dynamic columns.
> I thought, the whole point of Cassandra was to provide dynamic tables.

CQL3 absolutely provide "dynamic tables"/wide rows, the syntax is just
different. The typical example for wide rows is a time serie, for
instance keeping all the events for a given event_kind in the same C*
row ordered by time. You declare that in CQL3 using:
  CREATE TABLE events (
    event_kind text,
    time timestamp,
    event_name text,
    event_details text,
    PRIMARY KEY (event_kind, time)
  )

The important part in such definition is that one CQL row (i.e a given
event_kind, time, event_name, even_details) does not map to an internal
Cassandra row. More precisely, all events sharing the same event_kind will be
in the same internal row. This is a wide row/dynamic table in the sense of
thrift.


> I need to have a huge table to store market quotes, and be able to query it by name and
timestamp (t1 <= t <= t2), therefore I wanted the composite key.
> Loading data to such table using prepared statements (CQL 3-based) was very slow, because
it makes a server call for each row.

You should use a BATCH statement which is the equivalent to batch_mutate.

--
Sylvain

Mime
View raw message