Database Reference
In-Depth Information
Counter columns need their own table
Another surprising fact about counter columns is that they cannot coexist with regular data
columns in the same table. For instance, let's imagine that, along with view counts, we'd
like to record the timestamp of the last view of a status update on a given day. We might
think we can add a timestamp column to our daily_status_update_views table:
ALTER TABLE "daily_status_update_views"
ADD "last_view_time" timestamp;
However, if we attempt to perform this schema modification, we'll see an error:
Cassandra requires that counter columns live in their own table; they cannot coexist with
regular data columns or collection columns. Of course, counter tables still have primary
key columns with the full range of data types; in fact, primary key columns cannot have the
counter type, since using a primary key that cannot be directly set would not make sense.
Search WWH ::




Custom Search