Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[server][db] Tweak autovacuum threshold for trash table

Neeraj Guptadaaf73664a25
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
+);