Skip to content
Liam Brandt edited this page Nov 8, 2018 · 1 revision

Table Format

TABLE_NAME (
    COLUMN1_NAME type,
    COLUMN2_NAME type,
    …
    PRIMARY KEY ((PARTITION_KEY), (CLUSTERING_KEY))
) WITH CLUSTERING ORDER BY (COLUMN_NAME CLUSTERING_DIRECTION)

Tables

Latest snapshots by tenant

This table is for making the index page more efficient. It allows for access of only one partition to get the latest snapshot of every system owned by one tenant.

Should be used on:

  • System index page
latest_snapshots_by_tenant(
    tenant text,
    serial_number int,
    Snapshot blob,
    PRIMARY KEY ((tenant), (serial_number))
) WITH CLUSTERING ORDER BY (serial_number DESC)

Snapshots by serial number

This table is for querying for a specific system’s snapshot at some point in time. It should allow the query to only have to search one partition for a given system.

Should be used on:

  • System view page
  • System history?
snapshots_by_serial_number (
    tenant text,
    serial_number int,
    time timestamp,
    snapshot blob,
    PRIMARY KEY ((tenant, serial_number), (time))
) WITH CLUSTERING ORDER BY (time DESC)

Clone this wiki locally