Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between creating a table and creating a columnfamily in Cassandra?

I need details from both performance and query aspects, I learnt from some site that only a key can be given when using a columnfamily, if so what would you suggest for my keyspace, I need to use group by, order by, count, sum, ifnull, concat, joins, and some times nested queries.

like image 771
kumar Avatar asked Sep 16 '13 09:09

kumar


People also ask

What does a table mean in Cassandra?

It is the first component of the primary key definition. It can be a single column or, using an additional set of parenthesis, can be multiple columns. A table must have at least one partition key, the smallest possible table definition is: CREATE TABLE t (k text PRIMARY KEY);

Is column family a table?

A column family is a database object that contains columns of related data. It is a tuple (pair) that consists of a key–value pair, where the key is mapped to a value that is a set of columns. In analogy with relational databases, a column family is as a "table", each key-value pair being a "row".

What is the relationship between a column family and CQL table?

To answer the original question you posed: a column family and a table are the same thing. The name "column family" was used in the older Thrift API. The name "table" is used in the newer CQL API.

What is mandatory while creating a table in Cassandra?

The primary key is a column that is used to uniquely identify a row. Therefore,defining a primary key is mandatory while creating a table. A primary key is made of one or more columns of a table.


2 Answers

Refer the document: https://cassandra.apache.org/doc/old/CQL-3.0.html

It specifies that the LRM of the CQL supports TABLE keyword wherever COLUMNFAMILY is supported.

This is a proof that TABLE and COLUMNFAMILY are synonyms.

like image 37
user2250246 Avatar answered Sep 23 '22 04:09

user2250246


To answer the original question you posed: a column family and a table are the same thing.

  • The name "column family" was used in the older Thrift API.
  • The name "table" is used in the newer CQL API.

More info on the APIs can be found here: http://wiki.apache.org/cassandra/API

If you need to use "group by,order by,count,sum,ifnull,concat ,joins and some times nested querys" as you state then you probably don't want to use Cassandra, since it doesn't support most of those.

CQL supports COUNT, but only up to 10000. It supports ORDER BY, but only on clustering keys. The other things you mention are not supported at all.

like image 96
Ike Walker Avatar answered Sep 24 '22 04:09

Ike Walker