Skip to content

Commit

Permalink
Remove autovacuum setting from compressed chunks
Browse files Browse the repository at this point in the history
In old TSDB versions, we disabled autovacuum for compressed chunks to
keep the statistics. However, this restriction was removed in timescale#5118, but
no migration was performed to reset the custom autovacuum for existing
chunks.
  • Loading branch information
jnidzwetzki committed Mar 8, 2024
1 parent b719787 commit 61a12b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .unreleased/bugfix_6752
@@ -0,0 +1 @@
Fixes: #6752 Remove custom autovacuum setting from compressed chunks
18 changes: 17 additions & 1 deletion sql/updates/latest-dev.sql
Expand Up @@ -161,4 +161,20 @@ DROP FUNCTION IF EXISTS _timescaledb_functions.get_chunk_colstats;
DROP FUNCTION IF EXISTS _timescaledb_internal.get_chunk_relstats;
DROP FUNCTION IF EXISTS _timescaledb_internal.get_chunk_colstats;


-- In older TSDB versions, we disabled autovacuum for compressed chunks
-- to keep the statistics. However, this restriction was removed in
-- #5118 but no migration was performed to remove the custom
-- autovacuum setting for existing chunks.
DO $$
DECLARE
chunk regclass;
BEGIN
FOR chunk IN
SELECT format('%I.%I', schema_name, table_name)::regclass
FROM _timescaledb_catalog.chunk WHERE compressed_chunk_id IS NOT NULL
LOOP
EXECUTE format('ALTER TABLE %s RESET (autovacuum_enabled);', chunk::text);
END LOOP;
END
$$;
DO

0 comments on commit 61a12b9

Please sign in to comment.