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.

perf(data-warehouse): select only ids in the matview failure digest (#96276)

posthog[bot]b05e81771e02
diff --git a/posthog/tasks/email.py b/posthog/tasks/email.py
index 9b79e9e0b4d3..3580a815c9a9 100644
--- a/posthog/tasks/email.py
+++ b/posthog/tasks/email.py
@@ -1183,11 +1183,14 @@ def send_matview_failure_digest() -> None:
latest_job_status=DataModelingJob.Status.FAILED,
latest_job_run_at__gte=cutoff,
)
+ # Identifiers only: a full row also detoasts six JSON columns and the error text,
+ # for every saved query in every team.
+ .values("id", "team_id")
)
failed_ids_by_team: dict[int, list[str]] = {}
for sq in failed_queries:
- failed_ids_by_team.setdefault(sq.team_id, []).append(str(sq.id))
+ failed_ids_by_team.setdefault(sq["team_id"], []).append(str(sq["id"]))
# A suspended view runs no jobs, so its last failure ages out of the 24h window above.
suspended_ids_by_team = suspended_saved_query_ids_by_team(DataModelingJobEngine.CLICKHOUSE)