Versions:

DELETE

Data can be deleted from a hypertable using the standard DELETE SQL command (PostgreSQL docs), which will propagate down to the appropriate chunks that comprise the hypertable.

DELETE FROM conditions WHERE temperature < 35 OR humidity < 60;

DELETE FROM conditions WHERE time < NOW() - INTERVAL '1 month';

After running a large DELETE operation, users are recommended to VACUUM or VACUUM FULL the hypertable to reclaim storage occupied by deleted or obsoleted rows (PostgreSQL docs).

tip
For deleting old data, such as in the second example above, we recommend using the TimescaleDB function drop_chunksdrop_chunks_ instead. This feature is much more performant: it deletes entire _chunks_ of data (basically, removing files), rather than at the individual row level (necessitating vacuuming). See the section on data retention.

Found an issue on this page?

Report an issue!