From daaf73664a250945cdd844d30c40e7cb72043f0f Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 24 Jul 2025 13:14:09 +0530 Subject: [PATCH] [server][db] Tweak autovacuum threshold for trash table --- .../102_trash_vaccume_and_analyze_threshold.down.sql | 6 ++++++ .../102_trash_vaccume_and_analyze_threshold.up.sql | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 server/migrations/102_trash_vaccume_and_analyze_threshold.down.sql create mode 100644 server/migrations/102_trash_vaccume_and_analyze_threshold.up.sql diff --git a/server/migrations/102_trash_vaccume_and_analyze_threshold.down.sql b/server/migrations/102_trash_vaccume_and_analyze_threshold.down.sql new file mode 100644 index 0000000000..3d2dc0b0bf --- /dev/null +++ b/server/migrations/102_trash_vaccume_and_analyze_threshold.down.sql @@ -0,0 +1,6 @@ +ALTER TABLE trash RESET ( + autovacuum_analyze_scale_factor, + autovacuum_vacuum_scale_factor, + autovacuum_analyze_threshold, + autovacuum_vacuum_threshold + ); \ No newline at end of file diff --git a/server/migrations/102_trash_vaccume_and_analyze_threshold.up.sql b/server/migrations/102_trash_vaccume_and_analyze_threshold.up.sql new file mode 100644 index 0000000000..5d61312da7 --- /dev/null +++ b/server/migrations/102_trash_vaccume_and_analyze_threshold.up.sql @@ -0,0 +1,6 @@ +ALTER TABLE trash SET ( + autovacuum_analyze_scale_factor = 0.01, -- Trigger ANALYZE after 1% of rows change + autovacuum_vacuum_scale_factor = 0.02, -- Trigger VACUUM after 2% of rows change + autovacuum_analyze_threshold = 1000, + autovacuum_vacuum_threshold = 1000 +);