countTable
countTable contains all reported counts of all assets.
less than a minute
Usage
This table contains all reported counts of the assets.
Structure
key | data type | description | example |
---|---|---|---|
timestamp | timestamptz | Entry timestamp | 0 |
asset_id | serial | Asset id (see assetTable) | 1 |
count | integer | A count greater 0 | 1 |
Relations
DDL
CREATE TABLE IF NOT EXISTS countTable
(
timestamp TIMESTAMPTZ NOT NULL,
asset_id SERIAL REFERENCES assetTable (id),
count INTEGER CHECK (count > 0),
UNIQUE(timestamp, asset_id)
);
-- creating hypertable
SELECT create_hypertable('countTable', 'timestamp');
-- creating an index to increase performance
CREATE INDEX ON countTable (asset_id, timestamp DESC);
Last modified April 17, 2023: build: version 0.9.13 (6cb0a01)