在 TDengine 数据库中批量插入期间更新不起作用

update not working during batch insert in TDengine database

我创建了一个update=1的数据库,这样我就可以根据时间戳更新一些记录。但是我发现当我使用批量插入时更新不起作用。我也试过正常插入,更新记录有效。

Welcome to the TDengine shell from Linux, Client Version:2.1.7.2
Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.

taos> create database test update 1;
Query OK, 0 of 0 row(s) in database (0.007977s)

taos> use test;
Database changed.

taos> create table tb(ts timestamp, c1 int);
Query OK, 0 of 0 row(s) in database (0.015282s)

taos> insert into tb values(now, 1)(now, null);
Query OK, 1 of 1 row(s) in database (0.000797s)

taos> select * from tb;
           ts            |     c1      |
========================================
 2021-09-28 11:37:32.339 |           1 |
Query OK, 1 row(s) in set (0.002671s)

taos> insert into tb values("2021-09-28 11:37:32.339", null);
Query OK, 1 of 1 row(s) in database (0.000611s)

taos> select * from tb;
           ts            |     c1      |
========================================
 2021-09-28 11:37:32.339 |        NULL |
Query OK, 1 row(s) in set (0.002591s)

TDengine中批量插入和普通插入有什么区别?

批量插入使用相同的“现在”。它导致两个记录使用相同的时间戳,这不可能是有效的记录,因为时间序列数据库需要每个记录使用不同的时间戳。