Repository navigation
Description
What type of bug is this?
Incorrect result
What subsystems and features are affected?
Other
What happened?
Summary
We have a TimescaleDB hypertable that is continuously receiving new data.
A separate business process continuously deletes a portion of historical rows.
The hypertable is approximately 9 TB. The total database size is
approximately 19 TB.
public.large_hypertable
Problem
Running:
VACUUM (FULL, ANALYZE, VERBOSE) public.large_hypertable;reclaims approximately 2 TB of disk space. However, the operation takes
approximately 17 hours.
During this operation, queries against the affected hypertable/chunks are
blocked by locks. This is unacceptable for a production workload that must
continue serving reads and writes.
The largest individual chunks are approximately 9β12 GB each.
We attempted to process compressed chunks independently and in parallel:
VACUUM (FULL, ANALYZE, VERBOSE)
_timescaledb_internal._hyper_<hypertable_id>_<chunk_id>_chunk;The command finishes successfully for each logical chunk, but does not reclaim
the expected disk space. In contrast, VACUUM FULL on the entire hypertable
does reclaim space.
Example of the parallel run:
- 3101 compressed chunks discovered
- 3101 individual
VACUUM FULL ANALYZEcommands completed successfully - 0 SQL errors
- Execution time: approximately 2 minutes 39 seconds
- Expected disk-space reduction was not observed
Environment
TimescaleDB: 2.28.2
PostgreSQL: 17.10
Hypertable: public.large_hypertable
Hypertable size: ~9 TB
Total database size: ~19 TB
Disk space reclaimed by VACUUM FULL on the hypertable: ~2 TB
Largest chunks: ~9β12 GB
Questions
-
Is
VACUUM FULLon an individual logical compressed chunk
(_timescaledb_internal._hyper_*_chunk) expected to reclaim storage from
the underlying compressed relation? -
Is there a supported API to identify the physical compressed relation for
each logical chunk and safely runVACUUM FULLon it? -
Is there a supported way to run
VACUUM FULLfor compressed hypertables
chunk-by-chunk and in parallel, while avoiding a long blocking operation on
the entire hypertable? -
If this is not supported, what is the recommended maintenance strategy for
a multi-terabyte compressed hypertable with continuous inserts and deletes?
We need to reclaim disk space without blocking the production workload for
many hours.
TimescaleDB version affected
2.28.2
PostgreSQL version used
17.10
What operating system did you use?
Ubuntu 24.04 x64
What installation method did you use?
Source
What platform did you run on?
On prem/Self-hosted
Relevant log output and stack trace
How can we reproduce the bug?
We attempted to process compressed chunks independently and in parallel:
VACUUM (FULL, ANALYZE, VERBOSE)
_timescaledb_internal._hyper_<hypertable_id>_<chunk_id>_chunk;
The command finishes successfully for each logical chunk, but does not reclaim
the expected disk space
Activity
svenklemm commentedon Jul 17, 2026
Did you analyze which objects consume the space? Did you vacuum the internal compressed chunks or the uncompressed chunks?
sh4rkyusa-hub commentedon Jul 22, 2026
I wonder why here #9648 possibility to enable triggers on chunk tables was not implemented. That would possibly allow usage of pg_repack on chunks
Yet trying to run repack on chunk give an error
ERROR: operation not supported on chunk tables
Release 2.29.0
Release 2.29.0
Release 2.29.0