Introduction to Cassandra Query Language
Cassandra Query Language (CQL) is a query language for the Apache Cassandra database.
The Cassandra Query Language (CQL) is the primary language for communicating with the Apache Cassandra™ database. The most basic way to interact with Apache Cassandra is using the CQL shell, cqlsh. Using cqlsh, you can create keyspaces and tables, insert and query tables, plus much more. If you prefer a graphical tool, you can use DataStax DevCenter. For production, DataStax supplies a number drivers so that CQL statements can be passed from client to cluster and back.
Important: This document assumes you are familiar with either the Apache Cassandra 2.1.
CQL new features for Cassandra 2.1
Cassandra 2.1 new CQL features include:
- Nested user-defined types
- Improved counter columns that maintain the correct count when Cassandra replays the commit log
- Configurable counter cache
- Support for indexes on collections, including using map keys to filter query results
- Timestamps precise to the millisecond
- The new tuple type that holds fixed-length sets of typed positional fields
The cqlsh utility also has been improved:
- Capability to accept and execute a CQL statement from the operating system command line
- Support for describing types using the DESCRIBE command
Other notable changes:
- Cassandra rejects USING TIMESTAMP or USING TTL in the command to update a counter column, and now generates an error message when you attempt such an operation.
- In Cassandra 2.1, the CQL table property index_interval is replaced by min_index_interval and max_index_interval. The max_index_interval is 2048 by default. The default would be reached only when SSTables are infrequently-read and the index summary memory pool is full. When upgrading from earlier releases, Cassandra uses the old index_interval value for the min_index_interval.