: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
perf(error-tracking): index active issues by team and created_at (#115876)
posthog[bot]26a0f763fced
diff --git a/products/error_tracking/backend/migrations/0043_errortrackingissue_active_created_idx.py b/products/error_tracking/backend/migrations/0043_errortrackingissue_active_created_idx.pynew file mode 100644index 000000000000..2bdc46be0d6e--- /dev/null+++ b/products/error_tracking/backend/migrations/0043_errortrackingissue_active_created_idx.py@@ -0,0 +1,24 @@+from django.db import migrations, models++from posthog.migration_helpers import SafeAddIndexConcurrently+++class Migration(migrations.Migration):+ """The index behind the weekly digest's new-issues read, built without locking writes out of the table."""++ atomic = False++ dependencies = [+ ("error_tracking", "0042_errortrackingissuechange"),+ ]++ operations = [+ SafeAddIndexConcurrently(+ model_name="errortrackingissue",+ index=models.Index(+ condition=models.Q(("status", "active")),+ fields=["team", "-created_at"],+ name="et_issue_active_created_idx",+ ),+ ),+ ]diff --git a/products/error_tracking/backend/migrations/max_migration.txt b/products/error_tracking/backend/migrations/max_migration.txtindex 2b8017f52962..71cf1a1636d7 100644--- a/products/error_tracking/backend/migrations/max_migration.txt+++ b/products/error_tracking/backend/migrations/max_migration.txt@@ -1 +1 @@-0042_errortrackingissuechange+0043_errortrackingissue_active_created_idxdiff --git a/products/error_tracking/backend/models.py b/products/error_tracking/backend/models.pyindex 714158e2cd2e..de3fe92d9cec 100644--- a/products/error_tracking/backend/models.py+++ b/products/error_tracking/backend/models.py@@ -105,7 +105,12 @@ class ErrorTrackingIssue(UUIDTModel):fields=["team", "-state_updated_at"],name="et_issue_team_state_idx",condition=models.Q(state_updated_at__isnull=False),- )+ ),+ models.Index(+ fields=["team", "-created_at"],+ name="et_issue_active_created_idx",+ condition=models.Q(status="active"),+ ),]def merge(