: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(web-analytics): raise precompute today-bucket TTL to 2h (#64063)
Lucas Ricoy2c0d037d3def
diff --git a/products/web_analytics/backend/hogql_queries/web_analytics_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/web_analytics_lazy_precompute.pyindex a34c6de10d1d..66fb91c3e2e1 100644--- a/products/web_analytics/backend/hogql_queries/web_analytics_lazy_precompute.py+++ b/products/web_analytics/backend/hogql_queries/web_analytics_lazy_precompute.py@@ -65,7 +65,9 @@ WEB_ANALYTICS_LAZY_PRECOMPUTE_SUCCESS = Counter(# to UTC before filtering on `time_window_start`. Half-hour-offset timezones# (IST, Newfoundland, Nepal, etc.) are explicitly gated out below.LAZY_TTL_SECONDS: dict[str, int] = {- "0d": 15 * 60,+ # today: 2h — kept in sync with web_lazy_precompute_common.LAZY_TTL_SECONDS;+ # see there for the rationale (the ~6h result cache fronts these reads).+ "0d": 2 * 60 * 60,"1d": 60 * 60,"7d": 24 * 60 * 60,"default": 7 * 24 * 60 * 60,diff --git a/products/web_analytics/backend/hogql_queries/web_lazy_precompute_common.py b/products/web_analytics/backend/hogql_queries/web_lazy_precompute_common.pyindex 2b49996de9be..b12b33edb57a 100644--- a/products/web_analytics/backend/hogql_queries/web_lazy_precompute_common.py+++ b/products/web_analytics/backend/hogql_queries/web_lazy_precompute_common.py@@ -47,10 +47,13 @@ _FILTERS_ELIGIBILITY_HASH_IGNORED_QUERY_FIELDS: frozenset[str] = frozenset(})-# Hourly UTC bucketing TTL schedule. Today gets 15 min so dashboards stay-# fresh; older buckets get longer TTLs so we don't keep recomputing them.+# Hourly UTC bucketing TTL schedule. Today gets 2h: recomputing it more often+# buys nothing, since the ~6h HogQL result cache already fronts these queries (a+# cache hit never reads the precompute), and a tighter TTL just makes the warmer+# re-scan the whole current day every tick — which is what kept a full warm pass+# from finishing inside the hourly window. Older buckets get longer TTLs.LAZY_TTL_SECONDS: dict[str, int] = {- "0d": 15 * 60,+ "0d": 2 * 60 * 60,"1d": 60 * 60,"7d": 24 * 60 * 60,"default": 7 * 24 * 60 * 60,