Search code examples
cassandrathriftcql3cqlsh

CQL selecting rows without columns


After creating a table in CQL3:

CREATE TABLE data(
 row_key text,
 k1 text,
 k2 text,
 PRIMARY KEY (row_key , k1 ,k2 )
);

I would like to know all of the cassandra rows stored in that table. but when I run this in cqlsh:

SELECT row_key  FROM data;

I get back many duplicate entries. I basically get an entry for every column that I inserted. Meaning: I get an entry for row_key for every ( k1 & k2).

But my original intent was: "Give me a list of all the partition (row) keys". I do not want to serialize all of the columns (k1 & k2) too.

What am I doing wrong here?


Solution

  • I have currently hot fixed this by using "LIMIT 1" in my SELECT query. It still serializes one column, but not the entire row. This is better than nothing.