更新命令
Updates in TimescaleDB work as expected in standard SQL (PostgreSQL docs).
TimescaleDB的Updates
命令与标准SQL中的Updates
命令相同。
UPDATE conditions SET temperature = 70.2, humidity = 50.0
WHERE time = '2017-07-28 11:42:42.846621+00' AND location = 'office';
An update command can touch many rows at once, i.e., the following will modify all rows found in a 10-minute block of data.
一个更新命令可以同时更新多行数据行,如下语句会更新十分钟内的所有数据行。
UPDATE conditions SET temperature = temperature + 0.1
WHERE time >= '2017-07-28 11:40' AND time < '2017-07-28 11:50';
WARNING:TimescaleDB achieves much higher insert performance compared to vanilla PostgreSQL when inserts are localized to the most recent time interval (or two). If your workload is heavily based on UPDATEs to old time intervals instead, you may observe significantly lower write throughput.
警告:插入最新时间段的数据时,TimescaleDB的性能比vanilla PostgreSQL高的多。