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(replay): drop the dead GIN index on ee_single_session_summary (#92999)

posthog[bot]119a4ffb1ffe
diff --git a/products/replay/backend/migrations/0003_drop_exception_event_ids_gin_index.py b/products/replay/backend/migrations/0003_drop_exception_event_ids_gin_index.py
new file mode 100644
index 000000000000..ee12c2beb79e
--- /dev/null
+++ b/products/replay/backend/migrations/0003_drop_exception_event_ids_gin_index.py
@@ -0,0 +1,33 @@
+from django.db import migrations
+
+from posthog.migration_helpers.concurrent_index import DropIndexConcurrently
+
+
+class Migration(migrations.Migration):
+ """Drop the GIN index on `ee_single_session_summary.exception_event_ids`.
+
+ Migration 0002 removed the session-summarization models from Django state, so nothing reads
+ this column any more. The two remaining callers of the table, the recording deletion in
+ `nodejs/src/session-replay/recording-api/recording-service.ts` and the team predelete sweep in
+ `posthog/models/team/util.py`, both filter on `team_id` and use the composite index. The GIN
+ index only adds write cost to those deletes.
+
+ The operation is database-only because the model is gone from Django state, so there is no
+ index to remove from a model's `Meta.indexes`. The table drop stays blocked on the Node
+ recording service, as migration 0002 says.
+ """
+
+ atomic = False
+
+ dependencies = [
+ ("replay", "0002_remove_session_summary_models"),
+ ]
+
+ operations = [
+ DropIndexConcurrently(
+ index_name="idx_exception_event_ids_gin",
+ table_name="ee_single_session_summary",
+ columns="(exception_event_ids)",
+ using="gin",
+ ),
+ ]
diff --git a/products/replay/backend/migrations/max_migration.txt b/products/replay/backend/migrations/max_migration.txt
index aedd43ec851b..6145e2760057 100644
--- a/products/replay/backend/migrations/max_migration.txt
+++ b/products/replay/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0002_remove_session_summary_models
+0003_drop_exception_event_ids_gin_index