Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(error-tracking): lower symbol set autovacuum trigger threshold (#79782)

Eli Reisman84514de31db8
diff --git a/products/error_tracking/backend/migrations/0023_symbolset_autovacuum_scale_factor.py b/products/error_tracking/backend/migrations/0023_symbolset_autovacuum_scale_factor.py
new file mode 100644
index 000000000000..a81af80181c6
--- /dev/null
+++ b/products/error_tracking/backend/migrations/0023_symbolset_autovacuum_scale_factor.py
@@ -0,0 +1,30 @@
+from django.db import migrations
+
+# The table inherits the global autovacuum_vacuum_scale_factor of 0.1. At its current row
+# count that means autovacuum waits for tens of millions of dead tuples before running, so
+# the table carries a large steady-state bloat load from its delete and update churn.
+# 0.02 is a deliberately conservative first step: it lowers the trigger enough to matter
+# while keeping the extra vacuum passes affordable on a table with six indexes.
+TABLE = "posthog_errortrackingsymbolset"
+SCALE_FACTOR = 0.02
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("error_tracking", "0022_drop_redundant_symbolset_team_ref_idx"),
+ ]
+
+ operations = [
+ migrations.RunSQL(
+ sql=[
+ # Fail fast rather than queue: this waits behind an in-progress autovacuum
+ # on the same table, and a retry is cheaper than holding the lock request.
+ "SET LOCAL lock_timeout = '5s'",
+ f"ALTER TABLE {TABLE} SET (autovacuum_vacuum_scale_factor = {SCALE_FACTOR})",
+ ],
+ reverse_sql=[
+ "SET LOCAL lock_timeout = '5s'",
+ f"ALTER TABLE {TABLE} RESET (autovacuum_vacuum_scale_factor)",
+ ],
+ ),
+ ]
diff --git a/products/error_tracking/backend/migrations/max_migration.txt b/products/error_tracking/backend/migrations/max_migration.txt
index 3bb156feabe2..e6b5eb87ef52 100644
--- a/products/error_tracking/backend/migrations/max_migration.txt
+++ b/products/error_tracking/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0022_drop_redundant_symbolset_team_ref_idx
+0023_symbolset_autovacuum_scale_factor