Delete data
You can delete data from a hypertable using a standard DELETE SQL command. If you want to delete old data once it reaches a certain age, you can also drop entire chunks or set up a data retention policy.
Delete data with DELETE command
To delete data from a table, use the syntax DELETE FROM ...
. In this example, data is deleted from the table conditions
, if the row’s temperature
or humidity
is below a certain level:
DELETE FROM conditions WHERE temperature < 35 OR humidity < 60;
important
If you delete a lot of data, run VACUUM or VACUUM FULL
to reclaim storage from the deleted or obsolete rows.
Delete data by dropping chunks
TimescaleDB allows you to delete data by age, by dropping chunks from a hypertable. You can do so either manually or by data retention policy.
To learn more, see the data retention section.
当前内容版权归 TimescaleDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 TimescaleDB .