====TimescaleDB====
This type of [[start|distribution]] sends incoming data to a TimescaleDB server to be recorded.
TimescaleDB is a modified version of PostGRESQL designed to handle long term, high-speed time-series data without experiencing the major performance issues that arise when storing this sort of data in a traditional database engine.
===Type Name===
The type name to use in your configuration is **timescale**.
===Configuration===
The following configuration options are accepted...
^Name^Notes^Purpose^
|hostname|Required|The full path to your API endpoint, including **/api/v2/write**.|
|port|Default=5432|The host port number|
|database|Required|The name of the database to write to|
|table||The name of the table to write to|
|namefield||The name of the field that contains the measurement name|
|valuefield||The name of the field that contains the final value|
|timefield||The name of the field that contains the timestamp|
|username||The username to connect with|
|password||The password to connect with|
{
"type": "timescale",
"config": {
"hostname": "mydb.tsdb.cloud.timescale.com",
"database": "tsdb",
"username": "tsdbadmin",
"password": "passwd",
"table": "values",
"port": 64463,
"namefield": "name"
}
}
===Setup===
This recording technique expects a simple table structure made up of three fields - a **value name**, a **value** and a **time**.
To create a hypertable with this structure, try the following...
CREATE TABLE values (name VARCHAR(120),value DECIMAL,time TIMESTAMPTZ NOT NULL) WITH (
timescaledb.hypertable,
timescaledb.chunk_interval = '1 day'
);
You may then want to create an index to make searching for individual channels of data faster.
CREATE INDEX idx_name_time ON values (name, time DESC)
WITH (timescaledb.transaction_per_chunk);
This tells the system to create an index on the //name// column and split the index efficiently (if you're only going to retain a small amount of data, you can skip the part after-and-including **WITH**).
===Suggestions===
Keep the individual point names quite simple - we suggest **not** using options like 'fullpath'.