0

I read Datastax article about storing time series data https://academy.datastax.com/resources/getting-started-time-series-data-modeling

According article it should create wide rows for storing some time series. Like this(pic from article): enter image description here I created table:

CREATE TABLE test.times ( id text, time timestamp, temperature text, PRIMARY KEY (id, time));

And insert some values:

cqlsh> insert into test.times (id, time , temperature ) VALUES ( '1', '2013-04-03 07:03:00', '72F');
cqlsh> insert into test.times (id, time , temperature ) VALUES ( '1', '2013-04-03 07:03:01', '73F');
cqlsh> insert into test.times (id, time , temperature ) VALUES ( '1', '2013-04-03 07:03:02', '74F');
cqlsh> insert into test.times (id, time , temperature ) VALUES ( '2', '2013-04-03 07:04:02', '74F');
cqlsh> insert into test.times (id, time , temperature ) VALUES ( '2', '2013-04-03 07:04:03', '72F');

And I made dump of my times table using sstabledump tool. And I got next dump:

[
  {
    "partition" : {
      "key" : [ "2" ],
      "position" : 0
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 15,
        "clustering" : [ "2013-04-03 07:04+0200" ],
        "liveness_info" : { "tstamp" : 1463419324694096 },
        "cells" : [
          { "name" : "temperature", "value" : "74F" }
        ]
      },
      {
        "type" : "row",
        "position" : 36,
        "clustering" : [ "2013-04-03 07:04+0200" ],
        "liveness_info" : { "tstamp" : 1463419332655070 },
        "cells" : [
          { "name" : "temperature", "value" : "72F" }
        ]
      }
    ]
  },
  {
    "partition" : {
      "key" : [ "1" ],
      "position" : 58
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 73,
        "clustering" : [ "2013-04-03 07:03+0200" ],
        "liveness_info" : { "tstamp" : 1463419298628467 },
        "cells" : [
          { "name" : "temperature", "value" : "72F" }
        ]
      },
      {
        "type" : "row",
        "position" : 91,
        "clustering" : [ "2013-04-03 07:03+0200" ],
        "liveness_info" : { "tstamp" : 1463419310835537 },
        "cells" : [
          { "name" : "temperature", "value" : "73F" }
        ]
      },
      {
        "type" : "row",
        "position" : 112,
        "clustering" : [ "2013-04-03 07:03+0200" ],
        "liveness_info" : { "tstamp" : 1463419317481809 },
        "cells" : [
          { "name" : "temperature", "value" : "74F" }
        ]
      }
    ]
  }
]

As I saw C* created new row for every new entry. What I'm doing wrong? And how can I create wide row using CQL?

Cassandra v. 3.5

Cortwave
  • 4,747
  • 2
  • 25
  • 42

1 Answers1

3

You did it correctly. The wide row actually means a wide partition. You see that you have partitions (identified by id) that contain multiple logical cql rows. These partitions are what you want to be wide.

Links for C* 3.0 Storage Engine

  1. http://thelastpickle.com/blog/2016/03/04/introductiont-to-the-apache-cassandra-3-storage-engine.html

  2. http://www.datastax.com/2015/12/storage-engine-30

RussS
  • 16,476
  • 1
  • 34
  • 62
  • Does row in CQL the same as column in Thrift? – Cortwave May 16 '16 at 18:08
  • Kinda, the question is not really relevant in C* 3.0 where the storage system has been re-written. Previously you could kinda imagine a `cql row` as a group of adjacent cells, each cell having the clustering key values as it's "header" and the value of a distinct non primary key column as it's value. See http://stackoverflow.com/questions/20512710/cassandra-has-a-limit-of-2-billion-cells-per-partition-but-whats-a-partition/20525076#20525076 With the new storage format though there really isn't a Thrift equivalent anymore. – RussS May 16 '16 at 21:50
  • Thanks a lot! Can you advice some articles about data storage model in C* 3.x? – Cortwave May 17 '16 at 08:03