You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Boris Solovyov <bo...@gmail.com> on 2013/02/22 16:36:50 UTC

How wide rows are structured in CQL3

Hi,

My impression from reading docs is that in old versions of Cassandra, you
could create very wide rows, say with timestamps as column names for time
series data, and read an ordered slice of the row.  So,

RowKey    Columns
=======  ======
RowKey1  1:val1 2:val2 3:val3 .... N:valN

With this data I think you could say "get RowKey1, cols 100 to 1000" and
get a slice of values. (I have no experience with this, just from reading
about it.)

In CQL3 it looks like this is kind of "normalized" so I would have

CREATE TABLE X (
RowKey text,
TimeStamp int,
Value text,
PRIMARY KEY(RowKey, TimeStamp)
);

Does this effectively create the same storage structure?

Now, in CQL3, it looks like I should access it like this,

SELECT Value FROM X WHERE RowKey = 'RowKey1' AND TimeStamp BETWEEN 100 AND
1000;

Does this do the same thing?

I also don't understand some of the things like WITH COMPACT STORAGE and
CLUSTERING. I'm having a hard time figuring out how this maps to the
underlying storage. It is a little more abstract. I feel like the new CQL
stuff isn't really explained clearly to me -- is it just a query language
that accesses the same underlying structures, or is Cassandra's storage and
access model fundamentally different now?

Re: How wide rows are structured in CQL3

Posted by aaron morton <aa...@thelastpickle.com>.
> Does this effectively create the same storage structure?
Yes. 

> SELECT Value FROM X WHERE RowKey = 'RowKey1' AND TimeStamp BETWEEN 100 AND 1000;
select value from X where RoWKey  = 'foo' and timestamp >= 100 and timestamp <= 1000;
 
> I also don't understand some of the things like WITH COMPACT STORAGE and CLUSTERING.
Some info here, does not cover compact storage 
http://thelastpickle.com/2013/01/11/primary-keys-in-cql/

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 23/02/2013, at 4:36 AM, Boris Solovyov <bo...@gmail.com> wrote:

> Hi,
> 
> My impression from reading docs is that in old versions of Cassandra, you could create very wide rows, say with timestamps as column names for time series data, and read an ordered slice of the row.  So,
> 
> RowKey    Columns
> =======  ======
> RowKey1  1:val1 2:val2 3:val3 .... N:valN
> 
> With this data I think you could say "get RowKey1, cols 100 to 1000" and get a slice of values. (I have no experience with this, just from reading about it.)
> 
> In CQL3 it looks like this is kind of "normalized" so I would have
> 
> CREATE TABLE X (
> RowKey text,
> TimeStamp int,
> Value text,
> PRIMARY KEY(RowKey, TimeStamp)
> );
> 
> Does this effectively create the same storage structure?
> 
> Now, in CQL3, it looks like I should access it like this,
> 
> SELECT Value FROM X WHERE RowKey = 'RowKey1' AND TimeStamp BETWEEN 100 AND 1000;
> 
> Does this do the same thing?
> 
> I also don't understand some of the things like WITH COMPACT STORAGE and CLUSTERING. I'm having a hard time figuring out how this maps to the underlying storage. It is a little more abstract. I feel like the new CQL stuff isn't really explained clearly to me -- is it just a query language that accesses the same underlying structures, or is Cassandra's storage and access model fundamentally different now?