diff --git a/doc/cql/CQL.html b/doc/cql/CQL.html index b344bf302b..8d114c8fa5 100644 --- a/doc/cql/CQL.html +++ b/doc/cql/CQL.html @@ -1,4 +1,4 @@ -
Synopsis:
USE <KEYSPACE>;
+Cassandra Query Language (CQL) v0.99.1
Table of Contents
- Cassandra Query Language (CQL) v0.99.1
USE
Synopsis:
USE <KEYSPACE>;
A USE statement consists of the USE keyword, followed by a valid keyspace name. Its purpose is to assign the per-connection, current working keyspace. All subsequent keyspace-specific actions will be performed in the context of the supplied value.
SELECT
Synopsis:
SELECT [FIRST N] [REVERSED] <SELECT EXPR> FROM <COLUMN FAMILY> [USING <CONSISTENCY>]
[WHERE <CLAUSE>] [LIMIT N];
A SELECT is used to read one or more records from a Cassandra column family. It returns a result-set of rows, where each row consists of a key and a collection of columns corresponding to the query.
Specifying Columns
SELECT [FIRST N] [REVERSED] name1, name2, name3 FROM ...
@@ -35,4 +35,4 @@ UPDATE ... WHERE KEY IN (keyname1, keyname2)
A number of optional keyword arguments can be supplied to control the configuration of a new column family.
keyword default description comparator bytes Determines sorting and validation of column names. Valid values are identical to the types listed in Specifying Column Type above. comment none A free-form, human-readable comment. row_cache_size 0 Number of rows whose entire contents to cache in memory. key_cache_size 200000 Number of keys per SSTable whose locations are kept in memory in “mostly LRU” order. read_repair_chance 1.0 The probability with which read repairs should be invoked on non-quorum reads. gc_grace_seconds 864000 Time to wait before garbage collecting tombstones (deletion markers). default_validation bytes Determines validation of column values. Valid values are identical to the types listed in Specifying Column Type above. min_compaction_threshold 4 Minimum number of SSTables needed to start a minor compaction. max_compaction_threshold 32 Maximum number of SSTables allowed before a minor compaction is forced. row_cache_save_period_in_seconds 0 Number of seconds between saving row caches. key_cache_save_period_in_seconds 14400 Number of seconds between saving key caches. memtable_flush_after_mins 60 Maximum time to leave a dirty table unflushed. memtable_throughput_in_mb dynamic Maximum size of the memtable before it is flushed. memtable_operations_in_millions dynamic Number of operations in millions before the memtable is flushed. replicate_on_write false
CREATE INDEX
Synopsis:
CREATE INDEX [index_name] ON <column_family> (column_name);
A CREATE INDEX statement is used to create a new, automatic secondary index for the named column.
DROP
Synopsis:
DROP <KEYSPACE|COLUMNFAMILY> namespace;
DROP statements result in the immediate, irreversible removal of keyspace and column family namespaces.
Common Idioms
Specifying Consistency
... USING <CONSISTENCY> ...
-
Consistency level specifications are made up the keyword USING, followed by a consistency level identifier. Valid consistency levels are as follows:
CONSISTENCY ZEROCONSISTENCY ONE (default)CONSISTENCY QUORUMCONSISTENCY ALLCONSISTENCY DCQUORUMCONSISTENCY DCQUORUMSYNC
Term specification
Where possible, the type of terms are inferred; the following term types are supported:
String Literals
String literals are any value enclosed in double-quotes, (`"`). String literals are treated as raw bytes; no interpolation is performed.
Unicode
Unicode terms are any double-quoted string prefixed with a lower-case u, for example u"© 2011 The Apache Software Foundation". Unicode terms are identical to standard string literals, with the exception that they are encoded to bytes using the UTF-8 charset.
Integers / longs
Integers are any term consisting soley of unquoted numericals, longs are any otherwise valid integer term followed by an upper case “L”, (e.g. 100L). It is an error to specify an integer term that will not fit in 4 bytes unsigned, or a long that will not fit in 8 bytes unsigned.
UUIDs
There are two types of UUIDs supported by the CQL specification, time-based (version 1) and randomly generated (version 4). These are specified in statements using the timeuuid(<UUID STRING>) and uuid(<UUID STRING>) notations respectively.
In addition to the hex-based string representation, timeuuid() terms also accept arguments to specify the data-time component. The full list of timeuuid() arguments are:
argument example behavior none timeuuid() Results in the creation of a new UUID based on system time of the node parsing the query. now timeuuid(“now”) Results in the creation of a new UUID based on system time of the node parsing the query. milliseconds since epoch timeuuid(1296755320376) Creates a UUID with a time component that is based on the supplied time-stamp. iso8601 timestamp timeuuid(“2011-02-01T14:00-0600”) Creates a UUID with a time component that is based on the supplied time-stamp. string representation (hex) timeuuid(“e9229b24-2fbe-11e0-a4de-0026c650d722”) Reproduces the specified version 1 UUID node-side.
\ No newline at end of file
+Consistency level specifications are made up the keyword USING, followed by a consistency level identifier. Valid consistency levels are as follows:
CONSISTENCY ZEROCONSISTENCY ONE (default)CONSISTENCY QUORUMCONSISTENCY ALLCONSISTENCY DCQUORUMCONSISTENCY DCQUORUMSYNCTerms are used in statements to specify things such as keyspaces, column families, indexes, column names and values, and keyword arguments. The rules governing term specification are as follows:
'apple').carrot).100).1438fc5c-4ff6-11e0-b97f-0026c650d722). Terms which do not conform to these rules result in an exception.
How column name/value terms are interpreted is determined by the configured type.
| type | term |
|---|---|
| ascii | Any string which can be decoded using ASCII charset |
| utf8 | Any string which can be decoded using UTF8 charset |
| uuid | Standard UUID string format (hyphen-delimited hex notation) |
| timeuuid | Standard UUID string format (hyphen-delimited hex notation) |
| timeuuid | The string now, to represent a type-1 (time-based) UUID with a date-time component based on the current time |
| timeuuid | Numeric value representing milliseconds since epoch |
| timeuuid | An iso8601 timestamp |
| long | Numeric value capable of fitting in 8 bytes |
| int | Numeric value of arbitrary size |
| bytes | Hex-encoded strings (converted directly to the corresponding bytes) |