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 #5118, but
no migration was performed to reset the custom autovacuum setting for
existing chunks.
  • Loading branch information
jnidzwetzki committed Mar 8, 2024
1 parent 20a6b0a commit 67ad085
Show file tree
Hide file tree
Showing 2 changed files with 17 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
17 changes: 16 additions & 1 deletion sql/updates/latest-dev.sql
Expand Up @@ -161,4 +161,19 @@ 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 pg_catalog.format('%I.%I', schema_name, table_name)::regclass
FROM _timescaledb_catalog.chunk WHERE dropped = false
LOOP
EXECUTE pg_catalog.format('ALTER TABLE %s RESET (autovacuum_enabled);', chunk::text);
END LOOP;
END
$$;

0 comments on commit 67ad085

Please sign in to comment.