调研时序库时间戳列名称

  

时间戳列名

建表语句

示例

限制

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时间戳

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值