TDEngine | 自定义 | CREATE TABLE [IF NOT EXISTS] tb_name (timestamp_field_name TIMESTAMP, field1_name data_type1 [, field2_name data_type2 ...]); | taos> CREATE TABLE meters(ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS(location BINARY(30), groupId INT); Query OK, 0 row(s) affected (0.008245s) taos> INSERT INTO meters VALUES (NOW, 10.2, 219, 0.32); Query OK, 1 of 1 rows affected (0.001821s) | 表的第一个字段必须是 TIMESTAMP,并且系统自动将其设为主键; |
TimescaleDB | 自定义 支持时间戳、日期或整数 | 定义普通关系表,须包含时间戳列 CREATE TABLE table_name( column_name data_type, ... ); 转为时序超表,入参为原表名和时间戳列名 SELECT create_hypertable('table_name', 'column_time', ...); | CREATE TABLE conditions ( time TIMESTAMPTZ NOT NULL, location TEXT NOT NULL, temperature DOUBLE PRECISION NULL, humidity DOUBLE PRECISION NULL ); SELECT create_hypertable('conditions', 'time'); INSERT INTO conditions(time, location, temperature, humidity) VALUES (NOW(), 'office', 70.0, 50.0); | 超表创建时需要关联普通表的表名和时间字段,时间字段用于分片 |
InfluxDB | 固定为time | InfluxDB没有提供单独的建表语句,可以在插入时创建 insert <tbname>,<tags> <values> [timestamp] tbname : 数据表名称 tags : 表的tag域 values : 表的value域 timestamp :当前数据的时间戳(可选,没有提供的话系统会自带添加) | insert students,stuid=s123 score=79 insert students,stuid=s123 score=89 1488821368327436809 select * from students name: students time score stuid ---- ----- ----- 1488821368327436809 89 s123 1488821404414227498 79 s123 | influxdb的数据都有一列名为time的列,里面存储UTC时间戳 |