The Cassandra Query Language (CQL)

This document describes the Cassandra Query Language (CQL) version 3. Note that this document describes the last version of the language. However, the changes section provides the differences between the versions of CQL since version 3.0.

CQL offers a model similar to SQL. The data is stored in tables containing rows of columns. For that reason, when used in this document, these terms (tables, rows and columns) have the same definition that they have in SQL.

SQL developers should read these Cassandra-specific differences first:

  • INSERT is an upsert: it creates a row if it does not exist and overwrites it if the primary key already exists.

  • CQL does not support joins or arbitrary sub-queries.

  • Most queries must specify the partition key. When they do not, ALLOW FILTERING may be required and can be expensive.

  • The primary key controls both data distribution and row order, so table design starts from the query pattern.

  • There is no general-purpose full table scan path that behaves like SQL by default.