I created a database with update=1, so that I can update some records based on the timestamp. but I found the update is not working when I use batch insert. I also tried normal insert, updating record is working.
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)
what is the difference between batch insert and normal insert in TDengine?
Batch insertion uses the same "now". It leads two records to use the same timestamp which is not possible to be a valid record as the time-series database needs each record to use a different timestamp.