I want to create a table with wide partitions (or, put another way, a table
which has no value columns (non primary key columns)) that enables the
number of rows in any of its partitions to be efficiently procured. Here is
a simple definition of such a table


CREATE TABLE IF NOT EXISTS test_table
> (
>     partitionKeyCol         timestamp
>     clusteringCol           timeuuid
>     partitionRowCountCol    counter    static
>     PRIMARY KEY             (partitionKeyCol, clusteringCol)
> )


The problem with this definition, and others structured like it, is that
their validity cannot be clearly deduced from the information contained in
the docs.


*What the docs do state* (with regards to counters):

   - A counter column can neither be specified as part of a table's PRIMARY
   KEY, nor used to create an INDEX
   - A counter column can only be defined in a dedicated counter table
   (which I take to be a table which solely has counter columns defined as its
   value columns)


*What the docs do not state* (with regards to counters):

   - The ability of a table to have a static counter column defined for it
   (given the unique write path of counters, I feel that this is worth
   mentioning)
   - The ability of a table, which has zero value columns defined for it
   (making it a dedicated counter table, given my understanding of the term),
   to also have a static counter column defined for it

Given the information on this subject that is present in (and absent from)
the docs, such a definition appears to be valid. However, I'm not sure how
that is possible, given that the updates to partitionRowCountCol would
require use of a write path different from that used to insert
(partitionKeyCol, clusteringCol) tuples.

Is this type of counter table definition valid? If so, how are writes to
the table carried out?

Reply via email to