Linux/TimescaleDB: Difference between revisions

From Wiki
mNo edit summary
mNo edit summary
Line 3: Line 3:
CREATE TABLE sensor_data (
CREATE TABLE sensor_data (
         time TIMESTAMPTZ NOT NULL,
         time TIMESTAMPTZ NOT NULL,
         location TEXT,
         topic TEXT,
         value DOUBLE PRECISION
         value DOUBLE PRECISION
);
);
</pre>
</pre>
<pre>
<pre>
SELECT create_hypertable('sensor_data', 'time');
SELECT create_hypertable('sensor_data', 'time');
</pre>
== Insert data ==
<pre>
INSERT INTO sensor_data (time, topic, value)
VALUES (
    now(),
    '',
    ''
);
</pre>
</pre>


[[Category:Linux/Services]]
[[Category:Linux/Services]]
[[Category:Linux]]
[[Category:Linux]]

Revision as of 13:08, 28 September 2024

Setup

CREATE TABLE sensor_data (
        time TIMESTAMPTZ NOT NULL,
        topic TEXT,
        value DOUBLE PRECISION
);
SELECT create_hypertable('sensor_data', 'time');

Insert data

INSERT INTO sensor_data (time, topic, value)
VALUES (
    now(),
    '',
    ''
);