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.

refactor(web-analytics): replace pre-agg/lazy booleans with preComputeStrategy enum (#61922)

Lucas Ricoydcca3c438f50
diff --git a/frontend/src/queries/nodes/DataTable/DataTable.tsx b/frontend/src/queries/nodes/DataTable/DataTable.tsx
index 595b7669ef1c..f49290f1b0d3 100644
--- a/frontend/src/queries/nodes/DataTable/DataTable.tsx
+++ b/frontend/src/queries/nodes/DataTable/DataTable.tsx
@@ -73,6 +73,7 @@ import {
SessionAttributionExplorerQuery,
SessionsQuery,
TracesQuery,
+ WebAnalyticsPreComputeStrategy,
} from '~/queries/schema/schema-general'
import { QueryContext } from '~/queries/types'
import {
@@ -185,17 +186,16 @@ export function DataTable({
const canUseWebAnalyticsPreAggregatedTables = useFeatureFlag('SETTINGS_WEB_ANALYTICS_PRE_AGGREGATED_TABLES')
const hasCustomerAnalyticsEnabled = useFeatureFlag('CUSTOMER_ANALYTICS')
+ const preComputeStrategy = response && 'preComputeStrategy' in response ? response.preComputeStrategy : undefined
const usedWebAnalyticsPreAggregatedTables =
canUseWebAnalyticsPreAggregatedTables &&
+ preComputeStrategy === WebAnalyticsPreComputeStrategy.PreAggregated &&
response &&
- 'usedPreAggregatedTables' in response &&
- response.usedPreAggregatedTables &&
- response?.hogql
- // Lazy precompute can be on without the v2 pre-agg flag, so check it
- // independently of `canUseWebAnalyticsPreAggregatedTables`.
- const usedWebAnalyticsLazyPrecompute = Boolean(
- response && 'usedLazyPrecompute' in response && response.usedLazyPrecompute
- )
+ 'hogql' in response &&
+ response.hogql
+ // Lazy precompute can be on without the v2 pre-agg flag, so it surfaces a
+ // badge regardless of `canUseWebAnalyticsPreAggregatedTables`.
+ const usedWebAnalyticsLazyPrecompute = preComputeStrategy === WebAnalyticsPreComputeStrategy.LazyPrecompute
const dataTableLogicProps: DataTableLogicProps = {
query,
diff --git a/frontend/src/queries/nodes/OverviewGrid/OverviewGrid.tsx b/frontend/src/queries/nodes/OverviewGrid/OverviewGrid.tsx
index 1f3ed7654afe..2458cd7b597a 100644
--- a/frontend/src/queries/nodes/OverviewGrid/OverviewGrid.tsx
+++ b/frontend/src/queries/nodes/OverviewGrid/OverviewGrid.tsx
@@ -17,7 +17,7 @@ import { formatPercentage, humanFriendlyLargeNumber } from 'lib/utils/numbers'
import { teamLogic } from 'scenes/teamLogic'
import { EvenlyDistributedRows } from '~/queries/nodes/WebOverview/EvenlyDistributedRows'
-import { WebAnalyticsItemKind } from '~/queries/schema/schema-general'
+import { WebAnalyticsItemKind, WebAnalyticsPreComputeStrategy } from '~/queries/schema/schema-general'
export const NO_BASELINE_CHANGE_SENTINEL = 999999
@@ -57,8 +57,7 @@ interface OverviewGridProps {
loading: boolean
numSkeletons: number
samplingRate?: SamplingRate
- usedPreAggregatedTables?: boolean
- usedLazyPrecompute?: boolean
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
onDisablePrecompute?: () => void
labelFromKey: (key: string) => string
filterEmptyItems?: (item: OverviewItem) => boolean
@@ -70,8 +69,7 @@ export function OverviewGrid({
loading,
numSkeletons,
samplingRate,
- usedPreAggregatedTables = false,
- usedLazyPrecompute = false,
+ preComputeStrategy,
onDisablePrecompute,
labelFromKey,
filterEmptyItems = () => true,
@@ -96,8 +94,7 @@ export function OverviewGrid({
<OverviewItemCell
key={item.key}
item={item}
- usedPreAggregatedTables={usedPreAggregatedTables}
- usedLazyPrecompute={usedLazyPrecompute}
+ preComputeStrategy={preComputeStrategy}
onDisablePrecompute={onDisablePrecompute}
labelFromKey={labelFromKey}
compact={compact}
@@ -149,8 +146,7 @@ const OverviewItemCellSkeleton = ({ compact }: { compact: boolean }): JSX.Elemen
interface OverviewItemCellProps {
item: OverviewItem
- usedPreAggregatedTables: boolean
- usedLazyPrecompute: boolean
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
onDisablePrecompute?: () => void
labelFromKey: (key: string) => string
compact: boolean
@@ -158,8 +154,7 @@ interface OverviewItemCellProps {
const OverviewItemCell = ({
item,
- usedPreAggregatedTables,
- usedLazyPrecompute,
+ preComputeStrategy,
onDisablePrecompute,
labelFromKey,
compact,
@@ -241,9 +236,9 @@ const OverviewItemCell = ({
>
{/* Rendered as a sibling of the Tooltip trigger so hovering the badge
does not also surface the cell's metric tooltip. */}
- {usedLazyPrecompute ? (
+ {preComputeStrategy === WebAnalyticsPreComputeStrategy.LazyPrecompute ? (
<PreAggregatedBadge variant="precomputed" onDisable={onDisablePrecompute} />
- ) : usedPreAggregatedTables ? (
+ ) : preComputeStrategy === WebAnalyticsPreComputeStrategy.PreAggregated ? (
<PreAggregatedBadge variant="preagg" />
) : null}
<Tooltip title={tooltip}>
diff --git a/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx b/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx
index 3d06267f6ecd..b4ffca7a961b 100644
--- a/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx
+++ b/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx
@@ -11,6 +11,8 @@ import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { range } from 'lib/utils/arrays'
import { teamLogic } from 'scenes/teamLogic'
+import { WebAnalyticsPreComputeStrategy } from '~/queries/schema/schema-general'
+
import { formatItem, NO_BASELINE_CHANGE_SENTINEL, OverviewItem, SamplingNotice, SamplingRate } from './OverviewGrid'
export interface OverviewMetricCardItem extends Omit<OverviewItem, 'value' | 'previous'> {
@@ -23,8 +25,7 @@ interface OverviewMetricCardGridProps {
loading: boolean
numSkeletons: number
samplingRate?: SamplingRate
- usedPreAggregatedTables?: boolean
- usedLazyPrecompute?: boolean
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
onDisablePrecompute?: () => void
labelFromKey: (key: string) => string
}
@@ -34,8 +35,7 @@ export function OverviewMetricCardGrid({
loading,
numSkeletons,
samplingRate,
- usedPreAggregatedTables = false,
- usedLazyPrecompute = false,
+ preComputeStrategy,
onDisablePrecompute,
labelFromKey,
}: OverviewMetricCardGridProps): JSX.Element {
@@ -48,8 +48,7 @@ export function OverviewMetricCardGrid({
<MetricCardCell
key={item.key}
item={item}
- usedPreAggregatedTables={usedPreAggregatedTables}
- usedLazyPrecompute={usedLazyPrecompute}
+ preComputeStrategy={preComputeStrategy}
onDisablePrecompute={onDisablePrecompute}
labelFromKey={labelFromKey}
/>
@@ -62,14 +61,12 @@ export function OverviewMetricCardGrid({
function MetricCardCell({
item,
- usedPreAggregatedTables,
- usedLazyPrecompute,
+ preComputeStrategy,
onDisablePrecompute,
labelFromKey,
}: {
item: OverviewMetricCardItem
- usedPreAggregatedTables: boolean
- usedLazyPrecompute: boolean
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
onDisablePrecompute?: () => void
labelFromKey: (key: string) => string
}): JSX.Element {
@@ -107,9 +104,9 @@ function MetricCardCell({
tabIndex={clickable ? 0 : undefined}
aria-pressed={clickable ? !!item.selected : undefined}
>
- {usedLazyPrecompute ? (
+ {preComputeStrategy === WebAnalyticsPreComputeStrategy.LazyPrecompute ? (
<PreAggregatedBadge variant="precomputed" position="bottom-right" onDisable={onDisablePrecompute} />
- ) : usedPreAggregatedTables ? (
+ ) : preComputeStrategy === WebAnalyticsPreComputeStrategy.PreAggregated ? (
<PreAggregatedBadge variant="preagg" position="bottom-right" />
) : null}
<MetricCard
diff --git a/frontend/src/queries/nodes/WebOverview/WebOverview.tsx b/frontend/src/queries/nodes/WebOverview/WebOverview.tsx
index 2e91b1e2b10f..617403ee5061 100644
--- a/frontend/src/queries/nodes/WebOverview/WebOverview.tsx
+++ b/frontend/src/queries/nodes/WebOverview/WebOverview.tsx
@@ -46,9 +46,7 @@ export function WebOverview(props: {
const numSkeletons = props.query.conversionGoal ? 4 : 5
- const usedWebAnalyticsPreAggregatedTables =
- response && 'usedPreAggregatedTables' in response && response.usedPreAggregatedTables
- const usedWebAnalyticsLazyPrecompute = response && 'usedLazyPrecompute' in response && response.usedLazyPrecompute
+ const preComputeStrategy = webOverviewQueryResponse?.preComputeStrategy
const showWarning = hasReverseProxy === false && !!featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_EMPTY_ONBOARDING]
@@ -76,8 +74,7 @@ export function WebOverview(props: {
loading={responseLoading}
numSkeletons={numSkeletons}
samplingRate={samplingRate}
- usedPreAggregatedTables={usedWebAnalyticsPreAggregatedTables}
- usedLazyPrecompute={usedWebAnalyticsLazyPrecompute}
+ preComputeStrategy={preComputeStrategy}
onDisablePrecompute={props.context.onDisableWebAnalyticsPrecompute}
labelFromKey={labelFromKey}
/>
@@ -90,8 +87,7 @@ export function WebOverview(props: {
loading={responseLoading}
numSkeletons={numSkeletons}
samplingRate={samplingRate}
- usedPreAggregatedTables={usedWebAnalyticsPreAggregatedTables}
- usedLazyPrecompute={usedWebAnalyticsLazyPrecompute}
+ preComputeStrategy={preComputeStrategy}
onDisablePrecompute={props.context.onDisableWebAnalyticsPrecompute}
labelFromKey={labelFromKey}
/>
diff --git a/frontend/src/queries/nodes/WebVitals/WebVitalsPathBreakdown.tsx b/frontend/src/queries/nodes/WebVitals/WebVitalsPathBreakdown.tsx
index 427e66bc5ae5..0232ba5ca464 100644
--- a/frontend/src/queries/nodes/WebVitals/WebVitalsPathBreakdown.tsx
+++ b/frontend/src/queries/nodes/WebVitals/WebVitalsPathBreakdown.tsx
@@ -10,6 +10,7 @@ import { webAnalyticsLogic } from 'scenes/web-analytics/webAnalyticsLogic'
import {
AnyResponseType,
+ WebAnalyticsPreComputeStrategy,
WebVitalsMetricBand,
WebVitalsPathBreakdownQuery,
WebVitalsPathBreakdownQueryResponse,
@@ -54,7 +55,7 @@ export function WebVitalsPathBreakdown(props: {
return (
<div className="relative border rounded bg-surface-primary grid grid-cols-1 md:grid-cols-3 divide-y md:divide-y-0 md:divide-x min-h-60 h-full">
- {webVitalsQueryResponse?.usedLazyPrecompute && (
+ {webVitalsQueryResponse?.preComputeStrategy === WebAnalyticsPreComputeStrategy.LazyPrecompute && (
<PreAggregatedBadge variant="precomputed" onDisable={props.context.onDisableWebAnalyticsPrecompute} />
)}
<div className="p-4">
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 013ae7d9ad7f..bf239c9b9927 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -10864,6 +10864,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_metadata": {
"type": "object"
},
@@ -10900,14 +10903,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "description": "Whether the response was served from the lazy precompute path.",
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "description": "Whether the response was served from a precomputed table.",
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -10963,6 +10958,9 @@
"format": "date-time",
"type": "string"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_metadata": {
"type": "object"
},
@@ -10997,9 +10995,6 @@
},
"type": "array"
},
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -11061,6 +11056,9 @@
"format": "date-time",
"type": "string"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_metadata": {
"type": "object"
},
@@ -11095,12 +11093,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -11162,6 +11154,9 @@
"format": "date-time",
"type": "string"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_metadata": {
"type": "object"
},
@@ -11261,6 +11256,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_metadata": {
"type": "object"
},
@@ -11297,12 +11295,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -11358,6 +11350,9 @@
"format": "date-time",
"type": "string"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_metadata": {
"type": "object"
},
@@ -11391,9 +11386,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -13170,6 +13162,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -13198,12 +13193,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -13243,6 +13232,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -13273,12 +13265,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -13387,6 +13373,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -13417,14 +13406,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "description": "Whether the response was served from the lazy precompute path.",
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "description": "Whether the response was served from a precomputed table.",
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -13451,6 +13432,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -13478,9 +13462,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -32271,6 +32252,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -32299,12 +32283,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -32344,6 +32322,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -32374,12 +32355,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -32488,6 +32463,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -32518,14 +32496,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "description": "Whether the response was served from the lazy precompute path.",
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "description": "Whether the response was served from a precomputed table.",
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -32552,6 +32522,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -32579,9 +32552,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -32614,6 +32584,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -32681,6 +32654,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -32709,9 +32685,6 @@
},
"type": "array"
},
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -33531,6 +33504,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -33559,12 +33535,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -33604,6 +33574,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -33634,12 +33607,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -33748,6 +33715,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -33778,14 +33748,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "description": "Whether the response was served from the lazy precompute path.",
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "description": "Whether the response was served from a precomputed table.",
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -33812,6 +33774,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -33839,9 +33804,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -44660,6 +44622,11 @@
],
"type": "string"
},
+ "WebAnalyticsPreComputeStrategy": {
+ "description": "Which read path served a web analytics response.",
+ "enum": ["pre_aggregated", "lazy_precompute", "live"],
+ "type": "string"
+ },
"WebAnalyticsPropertyFilter": {
"anyOf": [
{
@@ -44980,6 +44947,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -45010,14 +44980,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "description": "Whether the response was served from the lazy precompute path.",
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "description": "Whether the response was served from a precomputed table.",
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -45171,6 +45133,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -45199,9 +45164,6 @@
},
"type": "array"
},
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -45231,9 +45193,6 @@
"previous": {
"type": "number"
},
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"value": {
"type": "number"
}
@@ -45354,6 +45313,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -45382,12 +45344,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -45517,6 +45473,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -45724,6 +45683,9 @@
"offset": {
"$ref": "#/definitions/integer"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -45754,12 +45716,6 @@
"items": {},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
- "usedPreAggregatedTables": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
@@ -45935,6 +45891,9 @@
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
+ "preComputeStrategy": {
+ "$ref": "#/definitions/WebAnalyticsPreComputeStrategy"
+ },
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
@@ -45962,9 +45921,6 @@
},
"type": "array"
},
- "usedLazyPrecompute": {
- "type": "boolean"
- },
"warnings": {
"description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries.",
"items": {
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 404281efb5bb..096bda7eeae1 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -2437,8 +2437,16 @@ export interface WebAnalyticsItemBase<T> {
changeFromPreviousPct?: number
isIncreaseBad?: boolean
}
-export interface WebOverviewItem extends WebAnalyticsItemBase<number> {
- usedPreAggregatedTables?: boolean
+export interface WebOverviewItem extends WebAnalyticsItemBase<number> {}
+
+/** Which read path served a web analytics response. */
+export enum WebAnalyticsPreComputeStrategy {
+ /** Served from the v2 continuously-maintained pre-aggregated tables. */
+ PreAggregated = 'pre_aggregated',
+ /** Served from the on-demand lazy precompute tables. */
+ LazyPrecompute = 'lazy_precompute',
+ /** Computed live from raw events (no precompute). */
+ Live = 'live',
}
export interface SamplingRate {
@@ -2451,8 +2459,7 @@ export interface WebOverviewQueryResponse extends AnalyticsQueryResponseBase {
samplingRate?: SamplingRate
dateFrom?: string
dateTo?: string
- usedPreAggregatedTables?: boolean
- usedLazyPrecompute?: boolean
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
}
export type CachedWebOverviewQueryResponse = CachedQueryResponse<WebOverviewQueryResponse>
@@ -2505,8 +2512,7 @@ export interface WebStatsTableQueryResponse extends AnalyticsQueryResponseBase {
hasMore?: boolean
limit?: integer
offset?: integer
- usedPreAggregatedTables?: boolean
- usedLazyPrecompute?: boolean
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
}
export type CachedWebStatsTableQueryResponse = CachedQueryResponse<WebStatsTableQueryResponse>
@@ -2543,10 +2549,7 @@ export interface WebGoalsQueryResponse extends AnalyticsQueryResponseBase {
hasMore?: boolean
limit?: integer
offset?: integer
- /** Whether the response was served from a precomputed table. */
- usedPreAggregatedTables?: boolean
- /** Whether the response was served from the lazy precompute path. */
- usedLazyPrecompute?: boolean
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
}
export type CachedWebGoalsQueryResponse = CachedQueryResponse<WebGoalsQueryResponse>
@@ -2595,7 +2598,7 @@ export type WebVitalsPathBreakdownResult = Record<WebVitalsMetricBand, WebVitals
// hence the tuple type rather than a single object.
export interface WebVitalsPathBreakdownQueryResponse extends AnalyticsQueryResponseBase {
results: [WebVitalsPathBreakdownResult]
- usedLazyPrecompute?: boolean
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
}
export type CachedWebVitalsPathBreakdownQueryResponse = CachedQueryResponse<WebVitalsPathBreakdownQueryResponse>
@@ -5537,6 +5540,7 @@ export interface WebPageURLSearchQueryResponse extends AnalyticsQueryResponseBas
results: PageURL[]
hasMore?: boolean
limit?: integer
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
}
export type CachedWebPageURLSearchQueryResponse = CachedQueryResponse<WebPageURLSearchQueryResponse>
@@ -5559,7 +5563,7 @@ export interface WebNotableChangeItem {
export interface WebNotableChangesQueryResponse extends AnalyticsQueryResponseBase {
results: WebNotableChangeItem[]
samplingRate?: SamplingRate
- usedPreAggregatedTables?: boolean
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy
}
export type CachedWebNotableChangesQueryResponse = CachedQueryResponse<WebNotableChangesQueryResponse>
diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsOverview/MarketingAnalyticsOverview.tsx b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsOverview/MarketingAnalyticsOverview.tsx
index aeb4e308757d..05db989de3bf 100644
--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsOverview/MarketingAnalyticsOverview.tsx
+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsOverview/MarketingAnalyticsOverview.tsx
@@ -87,7 +87,6 @@ export function MarketingAnalyticsOverview(props: {
loading={responseLoading}
numSkeletons={numSkeletons}
samplingRate={samplingRate}
- usedPreAggregatedTables={false}
labelFromKey={labelFromKey}
filterEmptyItems={filterEmptyMetrics}
/>
diff --git a/posthog/schema.py b/posthog/schema.py
index a5b159420b97..2878cb1907fb 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -279,6 +279,7 @@ from posthog.schema_enums import (
WebAnalyticsItemKind as WebAnalyticsItemKind,
WebAnalyticsOrderByDirection as WebAnalyticsOrderByDirection,
WebAnalyticsOrderByFields as WebAnalyticsOrderByFields,
+ WebAnalyticsPreComputeStrategy as WebAnalyticsPreComputeStrategy,
WebsiteBrowsingHistoryProdInterest as WebsiteBrowsingHistoryProdInterest,
WebStatsBreakdown as WebStatsBreakdown,
WebVitalsMetric as WebVitalsMetric,
@@ -3002,7 +3003,6 @@ class WebOverviewItem(BaseModel):
key: str
kind: WebAnalyticsItemKind
previous: float | None = None
- usedPreAggregatedTables: bool | None = None
value: float | None = None
@@ -7892,6 +7892,7 @@ class WebGoalsQueryResponse(BaseModel):
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -7910,14 +7911,6 @@ class WebGoalsQueryResponse(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = Field(
- default=None,
- description="Whether the response was served from the lazy precompute path.",
- )
- usedPreAggregatedTables: bool | None = Field(
- default=None,
- description="Whether the response was served from a precomputed table.",
- )
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -7943,6 +7936,7 @@ class WebNotableChangesQueryResponse(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -7960,7 +7954,6 @@ class WebNotableChangesQueryResponse(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -7988,6 +7981,7 @@ class WebOverviewQueryResponse(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -8005,8 +7999,6 @@ class WebOverviewQueryResponse(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -8034,6 +8026,7 @@ class WebPageURLSearchQueryResponse(BaseModel):
hogql: str | None = Field(default=None, description="Generated HogQL query.")
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -8079,6 +8072,7 @@ class WebStatsTableQueryResponse(BaseModel):
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -8097,8 +8091,6 @@ class WebStatsTableQueryResponse(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -12327,6 +12319,7 @@ class CachedWebGoalsQueryResponse(BaseModel):
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
next_allowed_client_refresh: AwareDatetime
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_metadata: dict[str, Any] | None = None
query_status: QueryStatus | None = Field(
default=None,
@@ -12347,14 +12340,6 @@ class CachedWebGoalsQueryResponse(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = Field(
- default=None,
- description="Whether the response was served from the lazy precompute path.",
- )
- usedPreAggregatedTables: bool | None = Field(
- default=None,
- description="Whether the response was served from a precomputed table.",
- )
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -12389,6 +12374,7 @@ class CachedWebNotableChangesQueryResponse(BaseModel):
last_refresh: AwareDatetime
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
next_allowed_client_refresh: AwareDatetime
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_metadata: dict[str, Any] | None = None
query_status: QueryStatus | None = Field(
default=None,
@@ -12408,7 +12394,6 @@ class CachedWebNotableChangesQueryResponse(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -12445,6 +12430,7 @@ class CachedWebOverviewQueryResponse(BaseModel):
last_refresh: AwareDatetime
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
next_allowed_client_refresh: AwareDatetime
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_metadata: dict[str, Any] | None = None
query_status: QueryStatus | None = Field(
default=None,
@@ -12464,8 +12450,6 @@ class CachedWebOverviewQueryResponse(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -12502,6 +12486,7 @@ class CachedWebPageURLSearchQueryResponse(BaseModel):
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
next_allowed_client_refresh: AwareDatetime
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_metadata: dict[str, Any] | None = None
query_status: QueryStatus | None = Field(
default=None,
@@ -12558,6 +12543,7 @@ class CachedWebStatsTableQueryResponse(BaseModel):
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
next_allowed_client_refresh: AwareDatetime
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_metadata: dict[str, Any] | None = None
query_status: QueryStatus | None = Field(
default=None,
@@ -12578,8 +12564,6 @@ class CachedWebStatsTableQueryResponse(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -12614,6 +12598,7 @@ class CachedWebVitalsPathBreakdownQueryResponse(BaseModel):
last_refresh: AwareDatetime
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
next_allowed_client_refresh: AwareDatetime
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_metadata: dict[str, Any] | None = None
query_status: QueryStatus | None = Field(
default=None,
@@ -12632,7 +12617,6 @@ class CachedWebVitalsPathBreakdownQueryResponse(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -13185,6 +13169,7 @@ class Response4(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -13202,8 +13187,6 @@ class Response4(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -13233,6 +13216,7 @@ class Response5(BaseModel):
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -13251,8 +13235,6 @@ class Response5(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -13329,6 +13311,7 @@ class Response7(BaseModel):
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -13347,14 +13330,6 @@ class Response7(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = Field(
- default=None,
- description="Whether the response was served from the lazy precompute path.",
- )
- usedPreAggregatedTables: bool | None = Field(
- default=None,
- description="Whether the response was served from a precomputed table.",
- )
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -13380,6 +13355,7 @@ class Response8(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -13396,7 +13372,6 @@ class Response8(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -16941,6 +16916,7 @@ class QueryResponseAlternative23(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -16958,8 +16934,6 @@ class QueryResponseAlternative23(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -16989,6 +16963,7 @@ class QueryResponseAlternative24(BaseModel):
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -17007,8 +16982,6 @@ class QueryResponseAlternative24(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -17085,6 +17058,7 @@ class QueryResponseAlternative26(BaseModel):
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -17103,14 +17077,6 @@ class QueryResponseAlternative26(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = Field(
- default=None,
- description="Whether the response was served from the lazy precompute path.",
- )
- usedPreAggregatedTables: bool | None = Field(
- default=None,
- description="Whether the response was served from a precomputed table.",
- )
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -17136,6 +17102,7 @@ class QueryResponseAlternative27(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -17152,7 +17119,6 @@ class QueryResponseAlternative27(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -17180,6 +17146,7 @@ class QueryResponseAlternative28(BaseModel):
hogql: str | None = Field(default=None, description="Generated HogQL query.")
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -17221,6 +17188,7 @@ class QueryResponseAlternative30(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -17238,7 +17206,6 @@ class QueryResponseAlternative30(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -17799,6 +17766,7 @@ class QueryResponseAlternative43(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -17816,8 +17784,6 @@ class QueryResponseAlternative43(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -17847,6 +17813,7 @@ class QueryResponseAlternative44(BaseModel):
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -17865,8 +17832,6 @@ class QueryResponseAlternative44(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = None
- usedPreAggregatedTables: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -17943,6 +17908,7 @@ class QueryResponseAlternative46(BaseModel):
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -17961,14 +17927,6 @@ class QueryResponseAlternative46(BaseModel):
description=("Measured timings for different parts of the query generation process"),
)
types: list | None = None
- usedLazyPrecompute: bool | None = Field(
- default=None,
- description="Whether the response was served from the lazy precompute path.",
- )
- usedPreAggregatedTables: bool | None = Field(
- default=None,
- description="Whether the response was served from a precomputed table.",
- )
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -17994,6 +17952,7 @@ class QueryResponseAlternative47(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -18010,7 +17969,6 @@ class QueryResponseAlternative47(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
@@ -20815,6 +20773,7 @@ class WebVitalsPathBreakdownQueryResponse(BaseModel):
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ preComputeStrategy: WebAnalyticsPreComputeStrategy | None = None
query_status: QueryStatus | None = Field(
default=None,
description=("Query status indicates whether next to the provided data, a query is still running."),
@@ -20831,7 +20790,6 @@ class WebVitalsPathBreakdownQueryResponse(BaseModel):
default=None,
description=("Measured timings for different parts of the query generation process"),
)
- usedLazyPrecompute: bool | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
description=(
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index 200e1880e1c3..7ca7d6f6a16d 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -3312,6 +3312,12 @@ class WebAnalyticsOrderByFields(StrEnum):
ERRORS = "Errors"
+class WebAnalyticsPreComputeStrategy(StrEnum):
+ PRE_AGGREGATED = "pre_aggregated"
+ LAZY_PRECOMPUTE = "lazy_precompute"
+ LIVE = "live"
+
+
class WebStatsBreakdown(StrEnum):
PAGE = "Page"
INITIAL_PAGE = "InitialPage"
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 777e76798912..0864852fe804 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -3349,6 +3349,15 @@ export const WebAnalyticsOrderByDirectionApi = {
Desc: 'DESC',
} as const
+export type WebAnalyticsPreComputeStrategyApi =
+ (typeof WebAnalyticsPreComputeStrategyApi)[keyof typeof WebAnalyticsPreComputeStrategyApi]
+
+export const WebAnalyticsPreComputeStrategyApi = {
+ PreAggregated: 'pre_aggregated',
+ LazyPrecompute: 'lazy_precompute',
+ Live: 'live',
+} as const
+
export interface SamplingRateApi {
denominator?: number | null
numerator: number
@@ -3365,6 +3374,7 @@ export interface WebStatsTableQueryResponseApi {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3376,8 +3386,6 @@ export interface WebStatsTableQueryResponseApi {
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
types?: unknown[] | null
- usedLazyPrecompute?: boolean | null
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -3444,7 +3452,6 @@ export interface WebOverviewItemApi {
key: string
kind: WebAnalyticsItemKindApi
previous?: number | null
- usedPreAggregatedTables?: boolean | null
value?: number | null
}
@@ -3457,6 +3464,7 @@ export interface WebOverviewQueryResponseApi {
hogql?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3467,8 +3475,6 @@ export interface WebOverviewQueryResponseApi {
samplingRate?: SamplingRateApi | null
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
- usedLazyPrecompute?: boolean | null
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -3723,6 +3729,7 @@ export interface Response4Api {
hogql?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3733,8 +3740,6 @@ export interface Response4Api {
samplingRate?: SamplingRateApi | null
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
- usedLazyPrecompute?: boolean | null
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -3750,6 +3755,7 @@ export interface Response5Api {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3761,8 +3767,6 @@ export interface Response5Api {
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
types?: unknown[] | null
- usedLazyPrecompute?: boolean | null
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -3804,6 +3808,7 @@ export interface Response7Api {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3815,10 +3820,6 @@ export interface Response7Api {
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
types?: unknown[] | null
- /** Whether the response was served from the lazy precompute path. */
- usedLazyPrecompute?: boolean | null
- /** Whether the response was served from a precomputed table. */
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -3841,6 +3842,7 @@ export interface Response8Api {
hogql?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3854,7 +3856,6 @@ export interface Response8Api {
results: WebVitalsPathBreakdownResultApi[]
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
- usedLazyPrecompute?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -5704,6 +5705,7 @@ export interface WebGoalsQueryResponseApi {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -5715,10 +5717,6 @@ export interface WebGoalsQueryResponseApi {
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
types?: unknown[] | null
- /** Whether the response was served from the lazy precompute path. */
- usedLazyPrecompute?: boolean | null
- /** Whether the response was served from a precomputed table. */
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -5825,6 +5823,7 @@ export interface WebVitalsPathBreakdownQueryResponseApi {
hogql?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -5838,7 +5837,6 @@ export interface WebVitalsPathBreakdownQueryResponseApi {
results: WebVitalsPathBreakdownResultApi[]
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
- usedLazyPrecompute?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index e6a38b61ccbc..7e8e5cfc1209 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -2799,6 +2799,15 @@ export const WebAnalyticsOrderByDirectionApi = {
Desc: 'DESC',
} as const
+export type WebAnalyticsPreComputeStrategyApi =
+ (typeof WebAnalyticsPreComputeStrategyApi)[keyof typeof WebAnalyticsPreComputeStrategyApi]
+
+export const WebAnalyticsPreComputeStrategyApi = {
+ PreAggregated: 'pre_aggregated',
+ LazyPrecompute: 'lazy_precompute',
+ Live: 'live',
+} as const
+
export interface SamplingRateApi {
denominator?: number | null
numerator: number
@@ -2815,6 +2824,7 @@ export interface WebStatsTableQueryResponseApi {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -2826,8 +2836,6 @@ export interface WebStatsTableQueryResponseApi {
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
types?: unknown[] | null
- usedLazyPrecompute?: boolean | null
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -2894,7 +2902,6 @@ export interface WebOverviewItemApi {
key: string
kind: WebAnalyticsItemKindApi
previous?: number | null
- usedPreAggregatedTables?: boolean | null
value?: number | null
}
@@ -2907,6 +2914,7 @@ export interface WebOverviewQueryResponseApi {
hogql?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -2917,8 +2925,6 @@ export interface WebOverviewQueryResponseApi {
samplingRate?: SamplingRateApi | null
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
- usedLazyPrecompute?: boolean | null
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -3173,6 +3179,7 @@ export interface Response4Api {
hogql?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3183,8 +3190,6 @@ export interface Response4Api {
samplingRate?: SamplingRateApi | null
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
- usedLazyPrecompute?: boolean | null
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -3200,6 +3205,7 @@ export interface Response5Api {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3211,8 +3217,6 @@ export interface Response5Api {
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
types?: unknown[] | null
- usedLazyPrecompute?: boolean | null
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -3254,6 +3258,7 @@ export interface Response7Api {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3265,10 +3270,6 @@ export interface Response7Api {
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
types?: unknown[] | null
- /** Whether the response was served from the lazy precompute path. */
- usedLazyPrecompute?: boolean | null
- /** Whether the response was served from a precomputed table. */
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -3291,6 +3292,7 @@ export interface Response8Api {
hogql?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3304,7 +3306,6 @@ export interface Response8Api {
results: WebVitalsPathBreakdownResultApi[]
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
- usedLazyPrecompute?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -5154,6 +5155,7 @@ export interface WebGoalsQueryResponseApi {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -5165,10 +5167,6 @@ export interface WebGoalsQueryResponseApi {
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
types?: unknown[] | null
- /** Whether the response was served from the lazy precompute path. */
- usedLazyPrecompute?: boolean | null
- /** Whether the response was served from a precomputed table. */
- usedPreAggregatedTables?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
@@ -5275,6 +5273,7 @@ export interface WebVitalsPathBreakdownQueryResponseApi {
hogql?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
+ preComputeStrategy?: WebAnalyticsPreComputeStrategyApi | null
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -5288,7 +5287,6 @@ export interface WebVitalsPathBreakdownQueryResponseApi {
results: WebVitalsPathBreakdownResultApi[]
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
- usedLazyPrecompute?: boolean | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarningApi[] | null
}
diff --git a/products/web_analytics/PRECOMPUTATION.md b/products/web_analytics/PRECOMPUTATION.md
index b81a27dd5d3f..aba0ee9b6d7d 100644
--- a/products/web_analytics/PRECOMPUTATION.md
+++ b/products/web_analytics/PRECOMPUTATION.md
@@ -107,7 +107,7 @@ The read is a single `sync_execute` call (not HogQL — see "Why bypass HogQL" b
- `load_balancing="in_order"` — paired with the INSERT side's same setting for read-your-writes via Approach E in [CONSISTENCY.md](../../products/analytics_platform/backend/lazy_computation/CONSISTENCY.md).
- `optimize_skip_unused_shards=1` — `job_id IN (...)` + sharding-by-`sipHash64(job_id)` lets ClickHouse prune to the right shards.
-Result is built into the standard `WebOverviewQueryResponse` via `_build_response_from_row`, with `usedPreAggregatedTables=True`.
+Result is built into the standard `WebOverviewQueryResponse` via `_build_response_from_row`, with `preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE`.
#### Why bypass HogQL
@@ -180,7 +180,7 @@ Single `sync_execute` over `web_stats_paths_preaggregated` with `uniqMergeIf` /
### Known follow-ups
- INITIAL_PAGE + bounce (entry-pathname tab) is a different SQL shape — separate precompute table or shared one with an entry-only state column.
-- `usedLazyPrecompute` is set on the response; the frontend's `PreAggregatedBadge` already keys off `usedPreAggregatedTables` so users see the badge without further wiring. Distinguishing lazy from v2 in the UI is a separate follow-up.
+- The response's `preComputeStrategy` is set to `WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE`; the frontend's `PreAggregatedBadge` keys off it (a distinct "precomputed" variant) so the lazy path is visually distinguishable from the v2 `PRE_AGGREGATED` path.
## Lazy computation for the web vitals path-breakdown tile
diff --git a/products/web_analytics/backend/hogql_queries/external_clicks.py b/products/web_analytics/backend/hogql_queries/external_clicks.py
index 648295d277f1..d7fa2fef8a7f 100644
--- a/products/web_analytics/backend/hogql_queries/external_clicks.py
+++ b/products/web_analytics/backend/hogql_queries/external_clicks.py
@@ -4,6 +4,7 @@ from posthog.schema import (
CachedWebStatsTableQueryResponse,
WebAnalyticsOrderByDirection,
WebAnalyticsOrderByFields,
+ WebAnalyticsPreComputeStrategy,
WebExternalClicksTableQuery,
WebExternalClicksTableQueryResponse,
WebStatsTableQueryResponse,
@@ -148,5 +149,6 @@ GROUP BY "context.columns.url"
types=response.types,
hogql=response.hogql,
modifiers=self.modifiers,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LIVE,
**self.paginator.response_params(),
)
diff --git a/products/web_analytics/backend/hogql_queries/metrics.py b/products/web_analytics/backend/hogql_queries/metrics.py
index 7acb335c89a3..ada3505444b4 100644
--- a/products/web_analytics/backend/hogql_queries/metrics.py
+++ b/products/web_analytics/backend/hogql_queries/metrics.py
@@ -28,14 +28,14 @@ WEB_ANALYTICS_QUERY_LATENCY_BUCKETS = [
WEB_ANALYTICS_QUERY_DURATION = Histogram(
"web_analytics_query_duration_seconds",
"Web analytics query execution latency in seconds",
- labelnames=["query_kind", "query_strategy", "used_preaggregated", "breakdown", "has_conversion_goal"],
+ labelnames=["query_kind", "query_strategy", "pre_compute_strategy", "breakdown", "has_conversion_goal"],
buckets=WEB_ANALYTICS_QUERY_LATENCY_BUCKETS,
)
WEB_ANALYTICS_QUERY_COUNTER = Counter(
"web_analytics_query_total",
"Total number of web analytics queries executed",
- labelnames=["query_kind", "query_strategy", "used_preaggregated", "breakdown", "has_conversion_goal"],
+ labelnames=["query_kind", "query_strategy", "pre_compute_strategy", "breakdown", "has_conversion_goal"],
)
WEB_ANALYTICS_QUERY_ERRORS = Counter(
diff --git a/products/web_analytics/backend/hogql_queries/notable_changes.py b/products/web_analytics/backend/hogql_queries/notable_changes.py
index 4d545451063c..df3893fbe27c 100644
--- a/products/web_analytics/backend/hogql_queries/notable_changes.py
+++ b/products/web_analytics/backend/hogql_queries/notable_changes.py
@@ -6,6 +6,7 @@ import structlog
from posthog.schema import (
CachedWebNotableChangesQueryResponse,
HogQLQueryModifiers,
+ WebAnalyticsPreComputeStrategy,
WebNotableChangeItem,
WebNotableChangesQuery,
WebNotableChangesQueryResponse,
@@ -63,7 +64,7 @@ class WebNotableChangesQueryRunner(WebAnalyticsQueryRunner[WebNotableChangesQuer
pre_agg_response = self._get_pre_aggregated_response()
if pre_agg_response is not None:
response = pre_agg_response
- used_preagg = True
+ strategy = WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
else:
response = execute_hogql_query(
query_type="web_notable_changes_query",
@@ -74,14 +75,14 @@ class WebNotableChangesQueryRunner(WebAnalyticsQueryRunner[WebNotableChangesQuer
modifiers=self.modifiers,
limit_context=self.limit_context,
)
- used_preagg = False
+ strategy = WebAnalyticsPreComputeStrategy.LIVE
if not response.results:
return WebNotableChangesQueryResponse(
results=[],
samplingRate=self._sample_rate,
modifiers=self.modifiers,
- usedPreAggregatedTables=used_preagg,
+ preComputeStrategy=strategy,
)
scored_items = self._score_results(response.results)
@@ -92,7 +93,7 @@ class WebNotableChangesQueryRunner(WebAnalyticsQueryRunner[WebNotableChangesQuer
results=top_items,
samplingRate=self._sample_rate,
modifiers=self.modifiers,
- usedPreAggregatedTables=used_preagg,
+ preComputeStrategy=strategy,
)
def _get_pre_aggregated_response(self):
diff --git a/products/web_analytics/backend/hogql_queries/page_url_search_query_runner.py b/products/web_analytics/backend/hogql_queries/page_url_search_query_runner.py
index 57863be54aba..b2c04a07d873 100644
--- a/products/web_analytics/backend/hogql_queries/page_url_search_query_runner.py
+++ b/products/web_analytics/backend/hogql_queries/page_url_search_query_runner.py
@@ -1,6 +1,7 @@
from posthog.schema import (
CachedWebPageURLSearchQueryResponse,
PageURL,
+ WebAnalyticsPreComputeStrategy,
WebPageURLSearchQuery,
WebPageURLSearchQueryResponse,
)
@@ -96,4 +97,5 @@ class PageUrlSearchQueryRunner(WebAnalyticsQueryRunner[WebPageURLSearchQueryResp
hasMore=len(response.results) >= limit,
hogql=response.hogql,
modifiers=self.modifiers,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LIVE,
)
diff --git a/products/web_analytics/backend/hogql_queries/stats_table.py b/products/web_analytics/backend/hogql_queries/stats_table.py
index 9f271ee264d2..be25823de0bc 100644
--- a/products/web_analytics/backend/hogql_queries/stats_table.py
+++ b/products/web_analytics/backend/hogql_queries/stats_table.py
@@ -10,6 +10,7 @@ from posthog.schema import (
PersonPropertyFilter,
WebAnalyticsOrderByDirection,
WebAnalyticsOrderByFields,
+ WebAnalyticsPreComputeStrategy,
WebStatsBreakdown,
WebStatsTableQuery,
WebStatsTableQueryResponse,
@@ -406,7 +407,7 @@ class WebStatsTableQueryRunner(WebAnalyticsQueryRunner[WebStatsTableQueryRespons
],
results=results,
modifiers=self.modifiers,
- usedLazyPrecompute=True,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE,
hasMore=result.has_more,
limit=self.paginator.limit,
offset=self.paginator.offset,
@@ -434,7 +435,6 @@ class WebStatsTableQueryRunner(WebAnalyticsQueryRunner[WebStatsTableQueryRespons
)
if rows is None:
return None
- self.used_preaggregated_tables = True
return self._build_response_from_lazy_rows(rows, limit=limit, offset=offset)
def _maybe_calculate_via_frustration_lazy_precompute(self) -> Optional[WebStatsTableQueryResponse]:
@@ -450,7 +450,6 @@ class WebStatsTableQueryRunner(WebAnalyticsQueryRunner[WebStatsTableQueryRespons
rows = execute_frustration_lazy_precomputed_read(self, limit=limit + 1, offset=offset)
if rows is None:
return None
- self.used_preaggregated_tables = True
return self._build_frustration_response_from_lazy_rows(rows, limit=limit, offset=offset)
def _build_frustration_response_from_lazy_rows(
@@ -496,8 +495,7 @@ class WebStatsTableQueryRunner(WebAnalyticsQueryRunner[WebStatsTableQueryRespons
],
results=results,
modifiers=self.modifiers,
- usedPreAggregatedTables=True,
- usedLazyPrecompute=True,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE,
hasMore=has_more,
limit=limit,
offset=offset,
@@ -555,8 +553,7 @@ class WebStatsTableQueryRunner(WebAnalyticsQueryRunner[WebStatsTableQueryRespons
columns=columns,
results=results,
modifiers=self.modifiers,
- usedPreAggregatedTables=True,
- usedLazyPrecompute=True,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE,
hasMore=has_more,
limit=limit,
offset=offset,
@@ -661,7 +658,11 @@ class WebStatsTableQueryRunner(WebAnalyticsQueryRunner[WebStatsTableQueryRespons
types=response.types,
hogql=response.hogql,
modifiers=self.modifiers,
- usedPreAggregatedTables=self.used_preaggregated_tables,
+ preComputeStrategy=(
+ WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
+ if self.used_preaggregated_tables
+ else WebAnalyticsPreComputeStrategy.LIVE
+ ),
**self.paginator.response_params(),
)
diff --git a/products/web_analytics/backend/hogql_queries/test/test_external_clicks_table.py b/products/web_analytics/backend/hogql_queries/test/test_external_clicks_table.py
index 0ca707b1afa4..92933cc1bc92 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_external_clicks_table.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_external_clicks_table.py
@@ -15,6 +15,7 @@ from posthog.schema import (
SessionTableVersion,
WebAnalyticsOrderByDirection,
WebAnalyticsOrderByFields,
+ WebAnalyticsPreComputeStrategy,
WebExternalClicksTableQuery,
)
@@ -84,8 +85,10 @@ class TestExternalClicksTableQueryRunner(ClickhouseTestMixin, APIBaseTest):
return runner.calculate()
def test_no_crash_when_no_data(self):
- results = self._run_external_clicks_table_query("2023-12-08", "2023-12-15").results
- self.assertEqual([], results)
+ response = self._run_external_clicks_table_query("2023-12-08", "2023-12-15")
+ self.assertEqual([], response.results)
+ # Always-live runner — never serves from a precompute path.
+ self.assertEqual(response.preComputeStrategy, WebAnalyticsPreComputeStrategy.LIVE)
def test_increase_in_users(
self,
diff --git a/products/web_analytics/backend/hogql_queries/test/test_notable_changes.py b/products/web_analytics/backend/hogql_queries/test/test_notable_changes.py
index acc41d7e887b..3b1bc6f5ba24 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_notable_changes.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_notable_changes.py
@@ -1,7 +1,13 @@
from freezegun import freeze_time
from posthog.test.base import APIBaseTest, ClickhouseTestMixin, _create_event, snapshot_clickhouse_queries
-from posthog.schema import CompareFilter, DateRange, HogQLQueryModifiers, WebNotableChangesQuery
+from posthog.schema import (
+ CompareFilter,
+ DateRange,
+ HogQLQueryModifiers,
+ WebAnalyticsPreComputeStrategy,
+ WebNotableChangesQuery,
+)
from posthog.models.utils import uuid7
@@ -39,7 +45,7 @@ class TestWebNotableChangesQueryRunner(ClickhouseTestMixin, APIBaseTest):
)
response = runner.calculate()
self.assertEqual(response.results, [])
- self.assertFalse(response.usedPreAggregatedTables)
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LIVE
def test_scoring_high_traffic_high_change_ranks_above_low_traffic(self):
runner = WebNotableChangesQueryRunner(
@@ -156,7 +162,7 @@ class TestWebNotableChangesQueryRunner(ClickhouseTestMixin, APIBaseTest):
)
response = runner.calculate()
- self.assertFalse(response.usedPreAggregatedTables)
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LIVE
self.assertGreater(len(response.results), 0)
# Results should be sorted by impact_score descending
diff --git a/products/web_analytics/backend/hogql_queries/test/test_page_url_search_query_runner.py b/products/web_analytics/backend/hogql_queries/test/test_page_url_search_query_runner.py
index 880ee8ed554c..7ca879e4a5fc 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_page_url_search_query_runner.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_page_url_search_query_runner.py
@@ -1,7 +1,7 @@
from freezegun import freeze_time
from posthog.test.base import APIBaseTest, ClickhouseTestMixin, _create_event, _create_person
-from posthog.schema import DateRange, WebPageURLSearchQuery
+from posthog.schema import DateRange, WebAnalyticsPreComputeStrategy, WebPageURLSearchQuery
from posthog.models.utils import uuid7
@@ -82,11 +82,13 @@ class TestPageUrlSearchQueryRunner(ClickhouseTestMixin, APIBaseTest):
return runner.calculate()
def test_no_crash_when_no_data(self):
- results = self._run_page_url_search_query(
+ response = self._run_page_url_search_query(
"2025-01-22",
"2025-01-29",
- ).results
- assert [] == results, "Expected empty results when no data is present"
+ )
+ assert [] == response.results, "Expected empty results when no data is present"
+ # Always-live runner — never serves from a precompute path.
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LIVE
def test_search_by_term(self):
s1 = str(uuid7("2025-01-22"))
diff --git a/products/web_analytics/backend/hogql_queries/test/test_web_analytics_metrics.py b/products/web_analytics/backend/hogql_queries/test/test_web_analytics_metrics.py
index 8edb471a5446..3cafe9753639 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_web_analytics_metrics.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_web_analytics_metrics.py
@@ -5,7 +5,7 @@ from unittest.mock import MagicMock, patch
from parameterized import parameterized
-from posthog.schema import WebStatsBreakdown
+from posthog.schema import WebAnalyticsPreComputeStrategy, WebStatsBreakdown
from posthog.clickhouse.query_tagging import (
Feature,
@@ -163,12 +163,12 @@ class TestWebAnalyticsMetrics(TestCase):
)
fake_response = MagicMock()
- fake_response.usedPreAggregatedTables = True
+ fake_response.preComputeStrategy = WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
with patch.object(WebAnalyticsQueryRunner.__mro__[1], "calculate", return_value=fake_response):
WebAnalyticsQueryRunner.calculate(runner)
- label_filter = {**expected_labels, "used_preaggregated": "true"}
+ label_filter = {**expected_labels, "pre_compute_strategy": "pre_aggregated"}
assert _get_counter_value(WEB_ANALYTICS_QUERY_COUNTER, label_filter) == 1.0
@patch(
@@ -196,7 +196,7 @@ class TestWebAnalyticsMetrics(TestCase):
counter_filter = {
"query_kind": "WebStatsTableQuery",
"query_strategy": "stats_table_simple_breakdown",
- "used_preaggregated": "unknown",
+ "pre_compute_strategy": "unknown",
}
assert _get_counter_value(WEB_ANALYTICS_QUERY_COUNTER, counter_filter) == 1.0
@@ -208,7 +208,7 @@ class TestWebAnalyticsMetrics(TestCase):
runner = _make_runner(query_kind="WebOverviewQuery", breakdown=None, properties=["fake_prop"])
fake_response = MagicMock()
- fake_response.usedPreAggregatedTables = False
+ fake_response.preComputeStrategy = WebAnalyticsPreComputeStrategy.LIVE
with (
patch.object(WebAnalyticsQueryRunner.__mro__[1], "calculate", return_value=fake_response),
@@ -226,7 +226,7 @@ class TestWebAnalyticsMetrics(TestCase):
assert kw["query_strategy"] is None
assert kw["clickhouse_query_type"] is None
assert kw["breakdown"] == "none"
- assert kw["used_preaggregated"] == "false"
+ assert kw["pre_compute_strategy"] == "live"
assert kw["error"] is False
assert kw["error_type"] is None
assert kw["filter_count"] == 1
@@ -242,7 +242,7 @@ class TestWebAnalyticsMetrics(TestCase):
cast(MagicMock, runner.clickhouse_query_type).return_value = "stats_table_path_bounce_query"
fake_response = MagicMock()
- fake_response.usedPreAggregatedTables = False
+ fake_response.preComputeStrategy = WebAnalyticsPreComputeStrategy.LIVE
with (
patch.object(WebAnalyticsQueryRunner.__mro__[1], "calculate", return_value=fake_response),
@@ -260,7 +260,7 @@ class TestWebAnalyticsMetrics(TestCase):
def test_all_breakdown_values_produce_valid_labels(self, _name, breakdown, _mock_tag):
runner = _make_runner(breakdown=breakdown)
fake_response = MagicMock()
- fake_response.usedPreAggregatedTables = None
+ fake_response.preComputeStrategy = None
with patch.object(WebAnalyticsQueryRunner.__mro__[1], "calculate", return_value=fake_response):
WebAnalyticsQueryRunner.calculate(runner)
@@ -271,10 +271,10 @@ class TestWebAnalyticsMetrics(TestCase):
@patch(
"products.web_analytics.backend.hogql_queries.web_analytics_query_runner.get_query_tag_value", return_value=None
)
- def test_preaggregated_none_maps_to_unknown(self, _mock_tag):
+ def test_pre_compute_strategy_none_maps_to_unknown(self, _mock_tag):
runner = _make_runner()
fake_response = MagicMock()
- fake_response.usedPreAggregatedTables = None
+ fake_response.preComputeStrategy = None
with patch.object(WebAnalyticsQueryRunner.__mro__[1], "calculate", return_value=fake_response):
WebAnalyticsQueryRunner.calculate(runner)
@@ -282,7 +282,7 @@ class TestWebAnalyticsMetrics(TestCase):
assert (
_get_counter_value(
WEB_ANALYTICS_QUERY_COUNTER,
- {"query_strategy": "none", "used_preaggregated": "unknown"},
+ {"query_strategy": "none", "pre_compute_strategy": "unknown"},
)
== 1.0
)
@@ -290,7 +290,7 @@ class TestWebAnalyticsMetrics(TestCase):
@patch(
"products.web_analytics.backend.hogql_queries.web_analytics_query_runner.get_query_tag_value", return_value=None
)
- def test_response_missing_preaggregated_attr_maps_to_unknown(self, _mock_tag):
+ def test_response_missing_pre_compute_strategy_attr_maps_to_unknown(self, _mock_tag):
runner = _make_runner()
fake_response = MagicMock(spec=[]) # empty spec = no attributes
@@ -300,7 +300,7 @@ class TestWebAnalyticsMetrics(TestCase):
assert (
_get_counter_value(
WEB_ANALYTICS_QUERY_COUNTER,
- {"query_strategy": "none", "used_preaggregated": "unknown"},
+ {"query_strategy": "none", "pre_compute_strategy": "unknown"},
)
== 1.0
)
@@ -344,7 +344,7 @@ class TestWebAnalyticsMetrics(TestCase):
cast(MagicMock, runner.query.model_dump).return_value = {"kind": query_kind}
fake_response = MagicMock()
- fake_response.usedPreAggregatedTables = False
+ fake_response.preComputeStrategy = WebAnalyticsPreComputeStrategy.LIVE
with patch.object(WebAnalyticsQueryRunner.__mro__[1], "calculate", return_value=fake_response):
WebAnalyticsQueryRunner.calculate(runner)
@@ -467,7 +467,7 @@ class TestWebAnalyticsMetrics(TestCase):
cast(MagicMock, runner.query.model_dump).return_value = expected_payload
fake_response = MagicMock()
- fake_response.usedPreAggregatedTables = False
+ fake_response.preComputeStrategy = WebAnalyticsPreComputeStrategy.LIVE
with patch.object(WebAnalyticsQueryRunner.__mro__[1], "calculate", return_value=fake_response):
WebAnalyticsQueryRunner.calculate(runner)
diff --git a/products/web_analytics/backend/hogql_queries/test/test_web_goals_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/test/test_web_goals_lazy_precompute.py
index 888e517288be..b137c9f7ba6e 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_web_goals_lazy_precompute.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_web_goals_lazy_precompute.py
@@ -13,6 +13,7 @@ from posthog.schema import (
PropertyOperator,
SessionPropertyFilter,
SessionsV2JoinMode,
+ WebAnalyticsPreComputeStrategy,
WebAnalyticsSampling,
WebGoalsQuery,
)
@@ -228,8 +229,7 @@ class TestWebGoalsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
with self._enable_lazy():
lazy_response = self._runner(self._build_query()).calculate()
- assert lazy_response.usedLazyPrecompute is True
- assert lazy_response.usedPreAggregatedTables is True
+ assert lazy_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
live_by_action = {r[0]: (r[1], r[2], r[3]) for r in live_response.results}
lazy_by_action = {r[0]: (r[1], r[2], r[3]) for r in lazy_response.results}
diff --git a/products/web_analytics/backend/hogql_queries/test/test_web_stats_frustration_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/test/test_web_stats_frustration_lazy_precompute.py
index 8d15e565f694..ba84f2ae5dae 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_web_stats_frustration_lazy_precompute.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_web_stats_frustration_lazy_precompute.py
@@ -17,6 +17,7 @@ from posthog.schema import (
SessionsV2JoinMode,
WebAnalyticsOrderByDirection,
WebAnalyticsOrderByFields,
+ WebAnalyticsPreComputeStrategy,
WebAnalyticsSampling,
WebStatsBreakdown,
WebStatsTableQuery,
@@ -285,8 +286,7 @@ class TestWebStatsFrustrationLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
team_id=self.team.pk, status=PreaggregationJob.Status.READY
).count()
assert ready_jobs > 0, "expected at least one READY precompute job"
- assert lazy_response.usedLazyPrecompute is True
- assert lazy_response.usedPreAggregatedTables is True
+ assert lazy_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
lazy_by_path = self._collect_metrics(lazy_response.results)
assert lazy_by_path == live_by_path, f"lazy/live mismatch: lazy={lazy_by_path}, live={live_by_path}"
diff --git a/products/web_analytics/backend/hogql_queries/test/test_web_stats_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/test/test_web_stats_lazy_precompute.py
index 1384c36a5acf..0d399209e609 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_web_stats_lazy_precompute.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_web_stats_lazy_precompute.py
@@ -14,6 +14,7 @@ from posthog.schema import (
PropertyOperator,
WebAnalyticsOrderByDirection,
WebAnalyticsOrderByFields,
+ WebAnalyticsPreComputeStrategy,
WebAnalyticsSampling,
WebStatsBreakdown,
WebStatsTableQuery,
@@ -203,7 +204,7 @@ class TestWebStatsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
team_id=self.team.pk, status=PreaggregationJob.Status.READY
).count()
assert ready_jobs > 0, f"expected a READY precompute job for {breakdown_by}"
- assert lazy_response.usedLazyPrecompute is True
+ assert lazy_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert lazy == raw, f"lazy/raw mismatch for {breakdown_by}: raw={raw}, lazy={lazy}"
@parameterized.expand(PARITY_BREAKDOWNS)
@@ -243,7 +244,7 @@ class TestWebStatsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
with self._enable_lazy():
response = self._run(self._build_query(breakdown_by=WebStatsBreakdown.VIEWPORT))
- assert response.usedLazyPrecompute is True
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert len(response.results) > 0
assert all(isinstance(row[0], tuple) and len(row[0]) == 2 for row in response.results)
@@ -331,7 +332,7 @@ class TestWebStatsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
response = self._run(self._build_query(breakdown_by=WebStatsBreakdown.LANGUAGE))
assert self._job_count() > 0
- assert response.usedLazyPrecompute is True
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert self._metrics(response) == [("en-US", (2.0, None), (4.0, None))]
@freeze_time("2024-01-15T12:00:00Z")
@@ -363,7 +364,7 @@ class TestWebStatsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
with self._enable_lazy():
lazy_response = self._run(self._build_query(breakdown_by=WebStatsBreakdown.LANGUAGE))
- assert lazy_response.usedLazyPrecompute is True
+ assert lazy_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert self._metrics(lazy_response) == raw
@freeze_time("2024-01-15T12:00:00Z")
@@ -395,7 +396,7 @@ class TestWebStatsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
with self._enable_lazy():
lazy_response = self._run(self._build_query(breakdown_by=WebStatsBreakdown.LANGUAGE))
- assert lazy_response.usedLazyPrecompute is True
+ assert lazy_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert self._metrics(lazy_response) == raw, f"raw={raw} lazy={self._metrics(lazy_response)}"
@freeze_time("2024-01-15T12:00:00Z")
@@ -585,9 +586,9 @@ class TestWebStatsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
response = self._run(query)
assert self._job_count() == 0
- # Raw path leaves `usedLazyPrecompute` unset; the failure mode we're
- # guarding against is the lazy path silently serving with a rewritten sort.
- assert response.usedLazyPrecompute is not True
+ # Raw path leaves `preComputeStrategy` off the lazy strategy; the failure mode
+ # we're guarding against is the lazy path silently serving with a rewritten sort.
+ assert response.preComputeStrategy != WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
@freeze_time("2024-01-15T12:00:00Z")
def test_pagination_page_two_lazy_matches_raw(self):
@@ -651,7 +652,7 @@ class TestWebStatsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
lazy_response = self._run(query)
lazy_metrics = self._metrics(lazy_response)
- assert lazy_response.usedLazyPrecompute is True
+ assert lazy_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert lazy_response.hasMore is True, "should report more rows past the requested page"
assert len(lazy_metrics) == 3
# Visitors are monotonically non-increasing on the returned page.
diff --git a/products/web_analytics/backend/hogql_queries/test/test_web_stats_paths_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/test/test_web_stats_paths_lazy_precompute.py
index d66f8e6d6aa7..fb1f9361e912 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_web_stats_paths_lazy_precompute.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_web_stats_paths_lazy_precompute.py
@@ -19,6 +19,7 @@ from posthog.schema import (
SessionsV2JoinMode,
WebAnalyticsOrderByDirection,
WebAnalyticsOrderByFields,
+ WebAnalyticsPreComputeStrategy,
WebAnalyticsSampling,
WebStatsBreakdown,
WebStatsTableQuery,
@@ -155,8 +156,7 @@ class TestWebStatsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
team_id=self.team.pk, status=PreaggregationJob.Status.READY
).count()
assert ready_jobs > 0, "expected at least one READY precompute job"
- assert lazy_response.usedLazyPrecompute is True
- assert lazy_response.usedPreAggregatedTables is True
+ assert lazy_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
lazy_by_path = self._collect_metrics(lazy_response.results)
@@ -490,7 +490,7 @@ class TestWebStatsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
)
@unittest.skip(
"CI-only flake since #59075 (passes locally on the CI ClickHouse image) — "
- "lazy path returns None on `usedLazyPrecompute` despite jobs being created "
+ "lazy path returns None on `preComputeStrategy` despite jobs being created "
"(`test_unfiltered_round_trip_creates_precompute_job` passes). Same root "
"cause as `test_lazy_result_matches_raw_result`: suspected read-after-write "
"visibility on the Distributed lazy read. `@unittest.skip` placed AFTER "
@@ -507,7 +507,7 @@ class TestWebStatsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
self._seed_two_sessions()
with self._enable_lazy():
response = self._run(self._build_query(order_by=[field, direction]))
- assert response.usedLazyPrecompute is True
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
@unittest.skip(
"CI-only flake since #59075 (passes locally on the CI ClickHouse image) — "
diff --git a/products/web_analytics/backend/hogql_queries/test/test_web_stats_pre_aggregated.py b/products/web_analytics/backend/hogql_queries/test/test_web_stats_pre_aggregated.py
index 93eedcfa548f..6eb3f3ecad27 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_web_stats_pre_aggregated.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_web_stats_pre_aggregated.py
@@ -11,6 +11,7 @@ from posthog.schema import (
EventPropertyFilter,
HogQLQueryModifiers,
PropertyOperator,
+ WebAnalyticsPreComputeStrategy,
WebStatsBreakdown,
WebStatsTableQuery,
)
@@ -413,7 +414,7 @@ class TestWebStatsPreAggregated(WebAnalyticsPreAggregatedTestBase):
]
assert response.results == expected_results
- assert response.usedPreAggregatedTables
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
def test_breakdown_consistency_preagg_vs_regular(self):
# Note: PAGE and VIEWPORT breakdowns are excluded. I will add them back in later.
@@ -430,8 +431,8 @@ class TestWebStatsPreAggregated(WebAnalyticsPreAggregatedTestBase):
regular_response = self._calculate_breakdown_query(breakdown, use_preagg=False)
# Verify both queries used their respective query engines
- assert preagg_response.usedPreAggregatedTables
- assert not regular_response.usedPreAggregatedTables
+ assert preagg_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
+ assert regular_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LIVE
assert self._sort_results(preagg_response.results) == self._sort_results(regular_response.results)
@@ -619,7 +620,7 @@ class TestWebStatsPreAggregated(WebAnalyticsPreAggregatedTestBase):
assert "subdomain.example.com/pricing" in breakdown_values
assert "example.com/pricing" in breakdown_values
- assert response.usedPreAggregatedTables
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
@parameterized.expand(
[
@@ -684,7 +685,7 @@ class TestWebStatsPreAggregated(WebAnalyticsPreAggregatedTestBase):
assert "/landing" in breakdown_values
assert "example.com/landing" not in breakdown_values
assert "subdomain.example.com/landing" not in breakdown_values
- assert response.usedPreAggregatedTables
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
def test_include_host_page_breakdown_groups_same_paths_separately(self):
self._truncate_preaggregated_tables()
@@ -764,8 +765,8 @@ class TestWebStatsPreAggregated(WebAnalyticsPreAggregatedTestBase):
assert with_host_dict["example.com/landing"][0] == 2
assert with_host_dict["subdomain.example.com/landing"][0] == 1
assert without_host_dict["/landing"][0] == 3
- assert with_host.usedPreAggregatedTables
- assert without_host.usedPreAggregatedTables
+ assert with_host.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
+ assert without_host.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
# NOTE: test_include_host_consistency_between_preagg_and_regular is not included because
# pre-aggregated tables have a known limitation where PAGE breakdown doesn't return mid-session pages.
diff --git a/products/web_analytics/backend/hogql_queries/test/test_web_stats_pre_aggregated_channel_types.py b/products/web_analytics/backend/hogql_queries/test/test_web_stats_pre_aggregated_channel_types.py
index 0b8230bdf1f8..4ade390258ab 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_web_stats_pre_aggregated_channel_types.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_web_stats_pre_aggregated_channel_types.py
@@ -1,7 +1,14 @@
from freezegun import freeze_time
from posthog.test.base import _create_event, _create_person, flush_persons_and_events
-from posthog.schema import DateRange, HogQLQueryModifiers, SessionPropertyFilter, WebStatsBreakdown, WebStatsTableQuery
+from posthog.schema import (
+ DateRange,
+ HogQLQueryModifiers,
+ SessionPropertyFilter,
+ WebAnalyticsPreComputeStrategy,
+ WebStatsBreakdown,
+ WebStatsTableQuery,
+)
from posthog.hogql.database.schema.channel_type import DEFAULT_CHANNEL_TYPES
@@ -391,8 +398,8 @@ class TestWebStatsPreAggregatedChannelTypes(WebAnalyticsPreAggregatedTestBase):
regular_response = self._calculate_channel_type_query(use_preagg=False)
# Verify both queries used their respective query engines
- assert preagg_response.usedPreAggregatedTables
- assert not regular_response.usedPreAggregatedTables
+ assert preagg_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
+ assert regular_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LIVE
actual_sorted = sorted(preagg_response.results, key=lambda x: x[0])
expected_sorted = sorted(regular_response.results, key=lambda x: x[0])
@@ -419,8 +426,8 @@ class TestWebStatsPreAggregatedChannelTypes(WebAnalyticsPreAggregatedTestBase):
)
# Verify that pre-aggregated tables were used
- assert preagg_response.usedPreAggregatedTables
- assert not regular_response.usedPreAggregatedTables
+ assert preagg_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
+ assert regular_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LIVE
preagg_result = preagg_response.results[0]
regular_result = regular_response.results[0]
@@ -443,7 +450,7 @@ class TestWebStatsPreAggregatedChannelTypes(WebAnalyticsPreAggregatedTestBase):
)
assert len(preagg_response.results) == 1
assert preagg_response.results[0][1] == (2.0, None) # 2 visitors
- assert preagg_response.usedPreAggregatedTables
+ assert preagg_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
# Test "Organic Search" - should get 1 session
preagg_response = self._calculate_channel_type_query(
@@ -454,7 +461,7 @@ class TestWebStatsPreAggregatedChannelTypes(WebAnalyticsPreAggregatedTestBase):
)
assert len(preagg_response.results) == 1
assert preagg_response.results[0][1] == (1.0, None) # 1 visitor
- assert preagg_response.usedPreAggregatedTables
+ assert preagg_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
# Test non-existent channel type - should get no results
preagg_response = self._calculate_channel_type_query(
@@ -466,4 +473,4 @@ class TestWebStatsPreAggregatedChannelTypes(WebAnalyticsPreAggregatedTestBase):
],
)
assert len(preagg_response.results) == 0
- assert preagg_response.usedPreAggregatedTables
+ assert preagg_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
diff --git a/products/web_analytics/backend/hogql_queries/test/test_web_vitals_paths_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/test/test_web_vitals_paths_lazy_precompute.py
index b1086b87d327..f1be90c34217 100644
--- a/products/web_analytics/backend/hogql_queries/test/test_web_vitals_paths_lazy_precompute.py
+++ b/products/web_analytics/backend/hogql_queries/test/test_web_vitals_paths_lazy_precompute.py
@@ -11,6 +11,7 @@ from posthog.schema import (
DateRange,
EventPropertyFilter,
PropertyOperator,
+ WebAnalyticsPreComputeStrategy,
WebAnalyticsSampling,
WebVitalsMetric,
WebVitalsMetricBand,
@@ -139,7 +140,7 @@ class TestWebVitalsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
self._seed()
with self._enable_lazy():
response = self._run(self._build_query())
- assert response.usedLazyPrecompute is True
+ assert response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert self._job_count() > 0, "expected at least one precompute job to be created"
@parameterized.expand(PARITY_MATRIX)
@@ -155,7 +156,7 @@ class TestWebVitalsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
lazy_response = self._run(self._build_query(metric=metric, percentile=percentile))
lazy = self._paths_with_values(lazy_response)
- assert lazy_response.usedLazyPrecompute is True
+ assert lazy_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert lazy.keys() == raw.keys(), f"path set mismatch for {metric}/{percentile}: raw={raw}, lazy={lazy}"
for path in raw:
raw_band, raw_value = raw[path]
@@ -181,7 +182,7 @@ class TestWebVitalsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
response = self._run(
self._build_query(conversion_goal=CustomEventConversionGoal(customEventName="$pageview")),
)
- assert response.usedLazyPrecompute is not True
+ assert response.preComputeStrategy != WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert self._job_count() == 0
@freeze_time("2024-01-15T12:00:00Z")
@@ -189,7 +190,7 @@ class TestWebVitalsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
self._seed()
with self._enable_lazy():
response = self._run(self._build_query(sampling=WebAnalyticsSampling(enabled=True)))
- assert response.usedLazyPrecompute is not True
+ assert response.preComputeStrategy != WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert self._job_count() == 0
@parameterized.expand(
@@ -211,7 +212,7 @@ class TestWebVitalsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
query.dateRange = DateRange(date_from=date_from, date_to=date_to, explicitDate=True)
with self._enable_lazy():
response = self._run(query)
- assert response.usedLazyPrecompute is not True
+ assert response.preComputeStrategy != WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert self._job_count() == 0
@freeze_time("2024-01-15T12:00:00Z")
@@ -227,14 +228,14 @@ class TestWebVitalsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
lazy_response = self._run(self._build_query())
lazy = self._paths_with_values(lazy_response)
- assert lazy_response.usedLazyPrecompute is True
+ assert lazy_response.preComputeStrategy == WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert raw == lazy, f"lazy/raw mismatch in IST: raw={raw}, lazy={lazy}"
@freeze_time("2024-01-15T12:00:00Z")
def test_query_optin_alone_falls_through_when_org_flag_disabled(self):
self._seed()
response = self._run(self._build_query(opt_in_precompute=True))
- assert response.usedLazyPrecompute is not True
+ assert response.preComputeStrategy != WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert self._job_count() == 0
@freeze_time("2024-01-15T12:00:00Z")
@@ -242,7 +243,7 @@ class TestWebVitalsPathsLazyPrecompute(ClickhouseTestMixin, APIBaseTest):
self._seed()
with self._enable_lazy():
response = self._run(self._build_query(opt_in_precompute=False))
- assert response.usedLazyPrecompute is not True
+ assert response.preComputeStrategy != WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE
assert self._job_count() == 0
@freeze_time("2024-01-15T12:00:00Z")
diff --git a/products/web_analytics/backend/hogql_queries/web_analytics_query_runner.py b/products/web_analytics/backend/hogql_queries/web_analytics_query_runner.py
index bdfcd60abbcb..95360b6a0311 100644
--- a/products/web_analytics/backend/hogql_queries/web_analytics_query_runner.py
+++ b/products/web_analytics/backend/hogql_queries/web_analytics_query_runner.py
@@ -151,17 +151,17 @@ class WebAnalyticsQueryRunner(AnalyticsQueryRunner[WAR], ABC):
query_strategy = query_strategy or "strategy_resolution_failed"
clickhouse_query_type = clickhouse_query_type or None
- used_preaggregated_label = "unknown"
+ pre_compute_strategy_label = "unknown"
if response is not None:
- val = getattr(response, "usedPreAggregatedTables", None)
- if val is not None:
- used_preaggregated_label = str(val).lower()
+ strategy = getattr(response, "preComputeStrategy", None)
+ if strategy is not None:
+ pre_compute_strategy_label = str(strategy)
query_strategy_label = query_strategy or "none"
metric_labels = {
"query_kind": query_kind,
"query_strategy": query_strategy_label,
- "used_preaggregated": used_preaggregated_label,
+ "pre_compute_strategy": pre_compute_strategy_label,
"breakdown": breakdown_label,
"has_conversion_goal": has_conversion_goal,
}
@@ -187,7 +187,7 @@ class WebAnalyticsQueryRunner(AnalyticsQueryRunner[WAR], ABC):
clickhouse_query_type=clickhouse_query_type,
breakdown=breakdown_label,
has_conversion_goal=has_conversion_goal,
- used_preaggregated=used_preaggregated_label,
+ pre_compute_strategy=pre_compute_strategy_label,
duration_s=round(duration_s, 4),
error=bool(error_type),
error_type=error_type or None,
diff --git a/products/web_analytics/backend/hogql_queries/web_goals.py b/products/web_analytics/backend/hogql_queries/web_goals.py
index 39fa4e956564..9521339080e1 100644
--- a/products/web_analytics/backend/hogql_queries/web_goals.py
+++ b/products/web_analytics/backend/hogql_queries/web_goals.py
@@ -1,7 +1,13 @@
from collections.abc import Iterator, Sequence
from typing import Optional, TypeVar
-from posthog.schema import CachedWebGoalsQueryResponse, WebAnalyticsOrderByFields, WebGoalsQuery, WebGoalsQueryResponse
+from posthog.schema import (
+ CachedWebGoalsQueryResponse,
+ WebAnalyticsOrderByFields,
+ WebAnalyticsPreComputeStrategy,
+ WebGoalsQuery,
+ WebGoalsQueryResponse,
+)
from posthog.hogql import ast
from posthog.hogql.parser import parse_select
@@ -194,7 +200,12 @@ WHERE {periods_expression}
try:
query = self.to_query()
except NoActionsError:
- return WebGoalsQueryResponse(results=[], samplingRate=self._sample_rate, modifiers=self.modifiers)
+ return WebGoalsQueryResponse(
+ results=[],
+ samplingRate=self._sample_rate,
+ modifiers=self.modifiers,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LIVE,
+ )
response = execute_hogql_query(
query_type="web_goals_query",
@@ -258,6 +269,7 @@ WHERE {periods_expression}
results=results,
samplingRate=self._sample_rate,
modifiers=self.modifiers,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LIVE,
)
def _maybe_calculate_via_lazy_precompute(self) -> Optional[WebGoalsQueryResponse]:
@@ -334,8 +346,7 @@ WHERE {periods_expression}
results=results,
samplingRate=self._sample_rate,
modifiers=self.modifiers,
- usedPreAggregatedTables=True,
- usedLazyPrecompute=True,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE,
)
def event_properties(self) -> ast.Expr:
diff --git a/products/web_analytics/backend/hogql_queries/web_overview.py b/products/web_analytics/backend/hogql_queries/web_overview.py
index 5ceb7c829816..db87b14d4169 100644
--- a/products/web_analytics/backend/hogql_queries/web_overview.py
+++ b/products/web_analytics/backend/hogql_queries/web_overview.py
@@ -6,6 +6,7 @@ import structlog
from posthog.schema import (
CachedWebOverviewQueryResponse,
HogQLQueryModifiers,
+ WebAnalyticsPreComputeStrategy,
WebOverviewQuery,
WebOverviewQueryResponse,
)
@@ -88,12 +89,7 @@ class WebOverviewQueryRunner(WebAnalyticsQueryRunner[WebOverviewQueryResponse]):
return None
return execute_lazy_precomputed_read(self)
- def _build_response_from_row(
- self,
- row: list,
- used_pre_aggregated: bool,
- used_lazy_precompute: bool = False,
- ) -> WebOverviewQueryResponse:
+ def _build_response_from_row(self, row: list) -> WebOverviewQueryResponse:
# Only called from the lazy precompute short-circuit; that path's gate
# already rejects conversionGoal, so we don't need a separate branch
# here. The v2/raw path builds its response inline in `_calculate`.
@@ -120,14 +116,13 @@ class WebOverviewQueryRunner(WebAnalyticsQueryRunner[WebOverviewQueryResponse]):
modifiers=self.modifiers,
dateFrom=self.query_date_range.date_from_str,
dateTo=self.query_date_range.date_to_str,
- usedPreAggregatedTables=used_pre_aggregated,
- usedLazyPrecompute=used_lazy_precompute,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE,
)
def _calculate(self) -> WebOverviewQueryResponse:
lazy_row = self.get_lazy_precomputed_row()
if lazy_row is not None:
- return self._build_response_from_row(lazy_row, used_pre_aggregated=True, used_lazy_precompute=True)
+ return self._build_response_from_row(lazy_row)
pre_aggregated_response = self.get_pre_aggregated_response()
@@ -177,7 +172,11 @@ class WebOverviewQueryRunner(WebAnalyticsQueryRunner[WebOverviewQueryResponse]):
modifiers=self.modifiers,
dateFrom=self.query_date_range.date_from_str,
dateTo=self.query_date_range.date_to_str,
- usedPreAggregatedTables=response == pre_aggregated_response,
+ preComputeStrategy=(
+ WebAnalyticsPreComputeStrategy.PRE_AGGREGATED
+ if response == pre_aggregated_response
+ else WebAnalyticsPreComputeStrategy.LIVE
+ ),
)
def all_properties(self) -> ast.Expr:
diff --git a/products/web_analytics/backend/hogql_queries/web_vitals_path_breakdown.py b/products/web_analytics/backend/hogql_queries/web_vitals_path_breakdown.py
index 3f0d24321644..5b196e7c8d52 100644
--- a/products/web_analytics/backend/hogql_queries/web_vitals_path_breakdown.py
+++ b/products/web_analytics/backend/hogql_queries/web_vitals_path_breakdown.py
@@ -1,5 +1,6 @@
from posthog.schema import (
CachedWebStatsTableQueryResponse,
+ WebAnalyticsPreComputeStrategy,
WebVitalsMetricBand,
WebVitalsPathBreakdownQuery,
WebVitalsPathBreakdownQueryResponse,
@@ -119,6 +120,7 @@ HAVING value >= 0
timings=response.timings,
hogql=response.hogql,
modifiers=self.modifiers,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LIVE,
)
def _get_results_for_band(
diff --git a/products/web_analytics/backend/hogql_queries/web_vitals_paths_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/web_vitals_paths_lazy_precompute.py
index 6cf2e8d459d3..8ef9d5a47e4e 100644
--- a/products/web_analytics/backend/hogql_queries/web_vitals_paths_lazy_precompute.py
+++ b/products/web_analytics/backend/hogql_queries/web_vitals_paths_lazy_precompute.py
@@ -11,6 +11,7 @@ from prometheus_client import Counter
from posthog.schema import (
HogQLQueryModifiers,
+ WebAnalyticsPreComputeStrategy,
WebVitalsMetric,
WebVitalsMetricBand,
WebVitalsPathBreakdownQueryResponse,
@@ -322,7 +323,7 @@ def _build_response(
],
timings=runner.timings.to_list() if runner.timings else None,
modifiers=runner.modifiers,
- usedLazyPrecompute=True,
+ preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE,
)
diff --git a/products/web_analytics/dags/eager_web_analytics_precompute.py b/products/web_analytics/dags/eager_web_analytics_precompute.py
index 4cb4723279e1..1a16a7e2cc49 100644
--- a/products/web_analytics/dags/eager_web_analytics_precompute.py
+++ b/products/web_analytics/dags/eager_web_analytics_precompute.py
@@ -63,7 +63,7 @@ import dagster
import structlog
from prometheus_client import Counter
-from posthog.schema import WebStatsBreakdown
+from posthog.schema import WebAnalyticsPreComputeStrategy, WebStatsBreakdown
from posthog.hogql.constants import LimitContext
@@ -278,13 +278,13 @@ def _warm_baseline_for_team(context: dagster.OpExecutionContext, team: Team) ->
EAGER_PRECOMPUTE_BASELINE_WARMED.labels(query_kind=label).inc()
warmed += 1
# Self-check the warm actually did its job: the tile must resolve to a
- # precompute read, not fall through to raw. `usedLazyPrecompute` is only
+ # precompute read, not fall through to raw. `preComputeStrategy == LAZY_PRECOMPUTE` is only
# True when the read passed the lazy executor's TTL freshness filter
# (`created_at + TTL >= now`, TTL = 15min today … 7d old), so True is a
# guarantee the precomputed value is well within the 2h threshold. A tile
# that comes back `not True` warmed nothing useful — surface it loudly so a
# stale/missing precompute or a non-precomputable breakdown can't hide.
- if getattr(response, "usedLazyPrecompute", None) is not True:
+ if getattr(response, "preComputeStrategy", None) != WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE:
EAGER_PRECOMPUTE_BASELINE_NOT_PRECOMPUTED.labels(query_kind=label).inc()
with _OP_LOG_LOCK:
context.log.warning(
diff --git a/products/web_analytics/dags/tests/test_eager_web_analytics_precompute.py b/products/web_analytics/dags/tests/test_eager_web_analytics_precompute.py
index a4126d4f90d6..cb4ed9eb0096 100644
--- a/products/web_analytics/dags/tests/test_eager_web_analytics_precompute.py
+++ b/products/web_analytics/dags/tests/test_eager_web_analytics_precompute.py
@@ -12,7 +12,7 @@ from django.utils import timezone
import dagster
from structlog.testing import capture_logs
-from posthog.schema import WebStatsBreakdown
+from posthog.schema import WebAnalyticsPreComputeStrategy, WebStatsBreakdown
from posthog.hogql_queries.query_runner import ExecutionMode
from posthog.models import Organization, Team
@@ -101,7 +101,9 @@ class TestWarmEagerBaselineOp(APIBaseTest):
_make_preagg_job(recent, computed_at=now)
_make_preagg_job(old, computed_at=now - timedelta(days=2))
# `never` has no PreaggregationJob row — it should warm first.
- get_runner.return_value = Mock(run=Mock(return_value=Mock(usedLazyPrecompute=True)))
+ get_runner.return_value = Mock(
+ run=Mock(return_value=Mock(preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE))
+ )
# Enrol in reverse-staleness order to prove the sort (not the input) drives it.
with _eager_audience([recent.pk, old.pk, never.pk]):
@@ -127,7 +129,9 @@ class TestWarmEagerBaselineOp(APIBaseTest):
_make_preagg_job(genuine, computed_at=now)
_make_preagg_job(noise_window, computed_at=now, time_range_end=now - timedelta(days=BASELINE_WINDOW_DAYS + 5))
_make_preagg_job(noise_status, computed_at=now, status=PreaggregationJob.Status.STALE)
- get_runner.return_value = Mock(run=Mock(return_value=Mock(usedLazyPrecompute=True)))
+ get_runner.return_value = Mock(
+ run=Mock(return_value=Mock(preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE))
+ )
with _eager_audience([genuine.pk, noise_window.pk, noise_status.pk]):
warm_eager_baseline_op(dagster.build_op_context())
@@ -144,7 +148,9 @@ class TestWarmEagerBaselineOp(APIBaseTest):
@patch(f"{_EAGER_MODULE}.tag_queries")
@patch(f"{_EAGER_MODULE}.get_query_runner")
def test_team_logs_carry_processed_total_progress(self, get_runner, _tag, _is_cloud):
- get_runner.return_value = Mock(run=Mock(return_value=Mock(usedLazyPrecompute=True)))
+ get_runner.return_value = Mock(
+ run=Mock(return_value=Mock(preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE))
+ )
teams = self._enroll_teams(count=3)
with _eager_audience([t.pk for t in teams]), capture_logs() as cap_logs:
warm_eager_baseline_op(dagster.build_op_context())
@@ -158,7 +164,7 @@ class TestWarmEagerBaselineOp(APIBaseTest):
t1, t2 = self._enroll_teams(count=2)
ok_runner = Mock()
- ok_runner.run.return_value = Mock(usedLazyPrecompute=True)
+ ok_runner.run.return_value = Mock(preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE)
bad_runner = Mock()
bad_runner.run.side_effect = RuntimeError("boom")
@@ -208,7 +214,7 @@ class TestWarmBaselineForTeam(APIBaseTest):
@patch("products.web_analytics.dags.eager_web_analytics_precompute.get_query_runner")
def test_warms_full_matrix(self, get_runner, tag_queries_mock):
runner = Mock()
- runner.run.return_value = Mock(usedLazyPrecompute=True)
+ runner.run.return_value = Mock(preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE)
get_runner.return_value = runner
warmed, failed = _warm_baseline_for_team(Mock(spec=dagster.OpExecutionContext), self.team)
@@ -225,10 +231,12 @@ class TestWarmBaselineForTeam(APIBaseTest):
@patch("products.web_analytics.dags.eager_web_analytics_precompute.tag_queries")
@patch("products.web_analytics.dags.eager_web_analytics_precompute.get_query_runner")
def test_flags_tiles_that_do_not_resolve_to_precompute(self, get_runner, tag_queries_mock):
- # A tile whose calculate() does not come back with usedLazyPrecompute=True fell
+ # A tile whose calculate() does not come back with preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE fell
# through to raw — the warm populated no fresh precompute. It still counts as
# "warmed" (it ran without error) but must be surfaced as not-precomputed.
- get_runner.return_value = Mock(run=Mock(return_value=Mock(usedLazyPrecompute=None)))
+ get_runner.return_value = Mock(
+ run=Mock(return_value=Mock(preComputeStrategy=WebAnalyticsPreComputeStrategy.LIVE))
+ )
with capture_logs() as cap_logs:
warmed, failed = _warm_baseline_for_team(Mock(spec=dagster.OpExecutionContext), self.team)
@@ -247,7 +255,7 @@ class TestWarmBaselineForTeam(APIBaseTest):
def capture(query, team, limit_context):
captured.append(query)
- return Mock(run=Mock(return_value=Mock(usedLazyPrecompute=True)))
+ return Mock(run=Mock(return_value=Mock(preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE)))
get_runner.side_effect = capture
_warm_baseline_for_team(Mock(spec=dagster.OpExecutionContext), self.team)
@@ -295,7 +303,7 @@ class TestWarmBaselineForTeam(APIBaseTest):
def record_get_runner(**kwargs):
call_order.append("get_runner")
- return Mock(run=Mock(return_value=Mock(usedLazyPrecompute=True)))
+ return Mock(run=Mock(return_value=Mock(preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE)))
tag_queries_mock.side_effect = record_tag
get_runner.side_effect = record_get_runner
@@ -318,7 +326,9 @@ class TestEagerBaselineLogging(APIBaseTest):
@patch("products.web_analytics.dags.eager_web_analytics_precompute.tag_queries")
@patch("products.web_analytics.dags.eager_web_analytics_precompute.get_query_runner")
def test_emits_structured_lifecycle_events_on_success(self, get_runner, _tag, _is_cloud):
- get_runner.return_value = Mock(run=Mock(return_value=Mock(usedLazyPrecompute=True)))
+ get_runner.return_value = Mock(
+ run=Mock(return_value=Mock(preComputeStrategy=WebAnalyticsPreComputeStrategy.LAZY_PRECOMPUTE))
+ )
with _eager_audience([self.team.pk]), capture_logs() as cap_logs:
warm_eager_baseline_op(dagster.build_op_context())
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 4e1179ea3b3a..d4df0eea2357 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -3157,6 +3157,15 @@ export namespace Schemas {
Desc: 'DESC',
} as const;
+ export type WebAnalyticsPreComputeStrategy = typeof WebAnalyticsPreComputeStrategy[keyof typeof WebAnalyticsPreComputeStrategy];
+
+
+ export const WebAnalyticsPreComputeStrategy = {
+ PreAggregated: 'pre_aggregated',
+ LazyPrecompute: 'lazy_precompute',
+ Live: 'live',
+ } as const;
+
export interface SamplingRate {
denominator?: number | null;
numerator: number;
@@ -3173,6 +3182,7 @@ export namespace Schemas {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
offset?: number | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3184,8 +3194,6 @@ export namespace Schemas {
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
types?: unknown[] | null;
- usedLazyPrecompute?: boolean | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -3248,7 +3256,6 @@ export namespace Schemas {
key: string;
kind: WebAnalyticsItemKind;
previous?: number | null;
- usedPreAggregatedTables?: boolean | null;
value?: number | null;
}
@@ -3261,6 +3268,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -3271,8 +3279,6 @@ export namespace Schemas {
samplingRate?: SamplingRate | null;
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedLazyPrecompute?: boolean | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -4401,6 +4407,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -4411,8 +4418,6 @@ export namespace Schemas {
samplingRate?: SamplingRate | null;
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedLazyPrecompute?: boolean | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -4428,6 +4433,7 @@ export namespace Schemas {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
offset?: number | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -4439,8 +4445,6 @@ export namespace Schemas {
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
types?: unknown[] | null;
- usedLazyPrecompute?: boolean | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -4482,6 +4486,7 @@ export namespace Schemas {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
offset?: number | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -4493,10 +4498,6 @@ export namespace Schemas {
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
types?: unknown[] | null;
- /** Whether the response was served from the lazy precompute path. */
- usedLazyPrecompute?: boolean | null;
- /** Whether the response was served from a precomputed table. */
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -4519,6 +4520,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -4532,7 +4534,6 @@ export namespace Schemas {
results: WebVitalsPathBreakdownResult[];
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedLazyPrecompute?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -5481,6 +5482,7 @@ export namespace Schemas {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
offset?: number | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -5492,10 +5494,6 @@ export namespace Schemas {
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
types?: unknown[] | null;
- /** Whether the response was served from the lazy precompute path. */
- usedLazyPrecompute?: boolean | null;
- /** Whether the response was served from a precomputed table. */
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -5586,6 +5584,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -5599,7 +5598,6 @@ export namespace Schemas {
results: WebVitalsPathBreakdownResult[];
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedLazyPrecompute?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -24267,6 +24265,7 @@ export namespace Schemas {
limit?: number | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -24345,6 +24344,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -24355,7 +24355,6 @@ export namespace Schemas {
samplingRate?: SamplingRate | null;
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -42131,6 +42130,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42141,8 +42141,6 @@ export namespace Schemas {
samplingRate?: SamplingRate | null;
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedLazyPrecompute?: boolean | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -42158,6 +42156,7 @@ export namespace Schemas {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
offset?: number | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42169,8 +42168,6 @@ export namespace Schemas {
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
types?: unknown[] | null;
- usedLazyPrecompute?: boolean | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -42212,6 +42209,7 @@ export namespace Schemas {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
offset?: number | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42223,10 +42221,6 @@ export namespace Schemas {
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
types?: unknown[] | null;
- /** Whether the response was served from the lazy precompute path. */
- usedLazyPrecompute?: boolean | null;
- /** Whether the response was served from a precomputed table. */
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -42238,6 +42232,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42251,7 +42246,6 @@ export namespace Schemas {
results: WebVitalsPathBreakdownResult[];
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedLazyPrecompute?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -42265,6 +42259,7 @@ export namespace Schemas {
limit?: number | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42293,6 +42288,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42303,7 +42299,6 @@ export namespace Schemas {
samplingRate?: SamplingRate | null;
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -42610,6 +42605,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42620,8 +42616,6 @@ export namespace Schemas {
samplingRate?: SamplingRate | null;
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedLazyPrecompute?: boolean | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -42637,6 +42631,7 @@ export namespace Schemas {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
offset?: number | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42648,8 +42643,6 @@ export namespace Schemas {
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
types?: unknown[] | null;
- usedLazyPrecompute?: boolean | null;
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -42691,6 +42684,7 @@ export namespace Schemas {
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
offset?: number | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42702,10 +42696,6 @@ export namespace Schemas {
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
types?: unknown[] | null;
- /** Whether the response was served from the lazy precompute path. */
- usedLazyPrecompute?: boolean | null;
- /** Whether the response was served from a precomputed table. */
- usedPreAggregatedTables?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}
@@ -42717,6 +42707,7 @@ export namespace Schemas {
hogql?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
+ preComputeStrategy?: WebAnalyticsPreComputeStrategy | null;
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatus | null;
/** The resolved previous/comparison period date range, when comparing against another period */
@@ -42730,7 +42721,6 @@ export namespace Schemas {
results: WebVitalsPathBreakdownResult[];
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
- usedLazyPrecompute?: boolean | null;
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. */
warnings?: DataWarehouseSyncWarning[] | null;
}