stateTable
stateTable contains the states of all assets.
less than a minute
Usage
This table contains all state changes of the assets.
Structure
| key | data type | description | example | 
|---|---|---|---|
| timestamp | timestamptz | Entry timestamp | 0 | 
| asset_id | serial | Asset ID (see assetTable) | 1 | 
| state | integer | State ID (see states) | 40000 | 
Relations
DDL
CREATE TABLE IF NOT EXISTS stateTable
(
    timestamp   TIMESTAMPTZ NOT NULL,
    asset_id    SERIAL      REFERENCES assetTable (id),
    state       INTEGER     CHECK (state >= 0),
    UNIQUE(timestamp, asset_id)
);
-- creating hypertable
SELECT create_hypertable('stateTable', 'timestamp');
-- creating an index to increase performance
CREATE INDEX ON stateTable (asset_id, timestamp DESC);
Last modified June 7, 2023: build: version 0.9.13 (bc08e78)
