遥测数据手动删除_物联网平台_边缘计算网关

数据表清空

💡 提示

数据表清空,时间短操作简单。

TRUNCATE ts_kv;

条件删除

💡 提示

根据数据量和过滤条件,执行时间可能很久。

1/3:执行删除语句

DELETE FROM ts_kv WHERE key= 点位的序号
DELETE FROM ts_kv WHERE ts= 时间,单位:毫秒
DELETE FROM ts_kv WHERE entity_id= 实体ID
-- 多条件组合
DELETE FROM ts_kv WHERE entity_id= 实体ID AND key= 点位的序号
SELECT key_id FROM ts_kv_dictionary WHERE key = 点位标识符
SELECT key_id FROM key_dictionary WHERE key = 点位标识符
SELECT id FROM device dev LEFT JOIN tk_organization org ON dev.organization_id = org.id WHERE name LIKE '%组织名字%'

2/3:清理空间

VACUUM ts_kv;

3/3:检查点存档

CHECKPOINT;
本文通过 YUQUE WORDPRESS 同步自语雀
云腾五洲-AI助理