Database Reference
In-Depth Information
on columns of this type. When performing inserts the
NOW()
function is used to generate a
TIMEUUID
A UTF-8 encoded string
VARCHAR
An arbitrary precision integer value
VARINT
Counter Columns
In Cassandra, atomic counter columns cannot be combined with other
nonkey columns in the column factory. A counter column may be
combined with other counter columns. Defining the original table
without metric in the primary key results in an error:
cqlsh:metrics> CREATE TABLE counts (
customer_id INT PRIMARY KEY,
metric TEXT,ts TIMESTAMP,
value COUNTER
);
Bad Request: Cannot add a counter column (value) in
a non counter column family
Defining a second counter on the original table is allowed:
cqlsh:metrics> CREATE TABLE counts_2 (
customer_id INT,
metric TEXT,
ts TIMESTAMP,
value COUNTER,
value_2 COUNTER,
PRIMARY KEY (customer_id,metric,ts));
If for some reason counter columns and noncounter columns are
needed, it is probably easiest to simply define two tables and update
both simultaneously using a batch update statement.