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.

fix(data-imports): stop diffing ExternalDataSchema.table in activity logs (#75741)

Tom Owers833a815a5718
diff --git a/posthog/models/activity_logging/activity_log.py b/posthog/models/activity_logging/activity_log.py
index 6c3a1f4906f6..881f93701aef 100644
--- a/posthog/models/activity_logging/activity_log.py
+++ b/posthog/models/activity_logging/activity_log.py
@@ -751,6 +751,11 @@ field_exclusions: dict[AuditableScope, list[str]] = {
"sync_type_config",
"latest_error",
"last_synced_at",
+ # Pipeline-assigned, not user intent. Diffing it resolves the FK through
+ # DataWarehouseTable.objects, whose manager adds two joins and a prefetch on every
+ # schema save (even ones that don't touch this field) — the extra queries have
+ # deadlocked with concurrent DDL in production.
+ "table",
],
"Evaluation": [
# Reverse relations — auto-managed by FK creates, not user intent.
diff --git a/posthog/test/activity_logging/test_external_data_schema_activity_logging.py b/posthog/test/activity_logging/test_external_data_schema_activity_logging.py
index ab698b6787af..be90ea94c95f 100644
--- a/posthog/test/activity_logging/test_external_data_schema_activity_logging.py
+++ b/posthog/test/activity_logging/test_external_data_schema_activity_logging.py
@@ -18,7 +18,8 @@ class TestExternalDataSchemaActivityLogging(ActivityLogTestHelper):
self.assertIn("latest_error", external_data_schema_exclusions)
self.assertIn("last_synced_at", external_data_schema_exclusions)
self.assertIn("status", external_data_schema_exclusions)
- self.assertEqual(len(external_data_schema_exclusions), 4)
+ self.assertIn("table", external_data_schema_exclusions)
+ self.assertEqual(len(external_data_schema_exclusions), 5)
def test_external_data_schema_scope_in_activity_log_types(self):
self.assertIn("ExternalDataSchema", get_args(ActivityScope))