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.

feat(insights): add sessionPropertyPreAggregation modifier (#57258)

Sam Pennington5eb5270f9fc1
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index ebcf52f347fd..6ef6e38dbb95 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -20592,6 +20592,10 @@
"description": "Push a `session_id_v7 IN (SELECT … FROM events WHERE …)` predicate into the raw_sessions subquery to limit aggregation to sessions that participate in the outer events filter.",
"type": "boolean"
},
+ "sessionPropertyPreAggregation": {
+ "description": "Pre-filter raw_sessions aggregation by `session_id_v7 IN (cheap pre-aggregation that only materializes the columns referenced by the outer-WHERE session predicate)`. Useful when the breakdown/SELECT pulls in many session columns (e.g. `$channel_type`) but the filter only references one (e.g. `$entry_current_url`).",
+ "type": "boolean"
+ },
"sessionTableVersion": {
"enum": ["auto", "v1", "v2", "v3"],
"type": "string"
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index ff6a5acf5602..51d4bf52aee9 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -418,6 +418,8 @@ export interface HogQLQueryModifiers {
optimizeJoinedFilters?: boolean
/** Push a `session_id_v7 IN (SELECT … FROM events WHERE …)` predicate into the raw_sessions subquery to limit aggregation to sessions that participate in the outer events filter. */
sessionIdPushdown?: boolean
+ /** Pre-filter raw_sessions aggregation by `session_id_v7 IN (cheap pre-aggregation that only materializes the columns referenced by the outer-WHERE session predicate)`. Useful when the breakdown/SELECT pulls in many session columns (e.g. `$channel_type`) but the filter only references one (e.g. `$entry_current_url`). */
+ sessionPropertyPreAggregation?: boolean
dataWarehouseEventsModifiers?: DataWarehouseEventsModifier[]
debug?: boolean
timings?: boolean
diff --git a/posthog/hogql/database/schema/sessions_v2.py b/posthog/hogql/database/schema/sessions_v2.py
index c950310c1f72..1e94869ff043 100644
--- a/posthog/hogql/database/schema/sessions_v2.py
+++ b/posthog/hogql/database/schema/sessions_v2.py
@@ -24,6 +24,7 @@ from posthog.hogql.database.schema.sessions_v1 import DEFAULT_BOUNCE_RATE_DURATI
from posthog.hogql.database.schema.util.where_clause_extractor import (
SessionMinTimestampWhereClauseExtractorV2,
build_session_id_v7_pushdown_predicate,
+ build_session_property_pre_aggregation_predicate,
)
from posthog.hogql.errors import ResolutionError
from posthog.hogql.modifiers import create_default_modifiers_for_team
@@ -501,6 +502,18 @@ def join_events_table_to_sessions_table_v2(
events_session_id_field=["$session_id_uuid"],
)
+ if context.modifiers.sessionPropertyPreAggregation:
+ pre_agg_where = build_session_property_pre_aggregation_predicate(
+ node,
+ join_to_add,
+ context,
+ requested_fields=join_to_add.fields_accessed,
+ select_from_fn=select_from_sessions_table_v2,
+ session_id_v7_field=ast.Field(chain=["raw_sessions", "session_id_v7"]),
+ )
+ if pre_agg_where is not None:
+ extra_where = ast.And(exprs=[extra_where, pre_agg_where]) if extra_where is not None else pre_agg_where
+
join_expr = ast.JoinExpr(
table=select_from_sessions_table_v2(join_to_add.fields_accessed, node, context, extra_where=extra_where)
)
diff --git a/posthog/hogql/database/schema/util/test/test_session_v2_where_clause_extractor.py b/posthog/hogql/database/schema/util/test/test_session_v2_where_clause_extractor.py
index 4db8ae66e38b..1d28183e6032 100644
--- a/posthog/hogql/database/schema/util/test/test_session_v2_where_clause_extractor.py
+++ b/posthog/hogql/database/schema/util/test/test_session_v2_where_clause_extractor.py
@@ -715,3 +715,115 @@ WHERE events.timestamp >= '2026-03-27 00:00:00'
assert "or(" in in_subquery, f"Expected OR preserved in IN; got:\n{in_subquery}"
else:
assert "or(" not in in_subquery, f"Expected no OR in narrowed IN; got:\n{in_subquery}"
+
+
+class TestSessionPropertyPreAggregationV2(ClickhouseTestMixin, APIBaseTest):
+ # Tests for the sessionPropertyPreAggregation modifier — narrows the raw_sessions GROUP BY
+ # hash table by IN-filtering on a cheap pre-aggregation that only materializes the columns
+ # the outer-WHERE session predicate references. Useful when SELECT pulls in many session
+ # columns (e.g. $channel_type) but the filter only references one (e.g. $entry_current_url).
+
+ def print_query(self, query: str, modifier_on: bool) -> str:
+ team = self.team
+ modifiers = create_default_modifiers_for_team(team)
+ modifiers.sessionTableVersion = SessionTableVersion.V2
+ modifiers.sessionPropertyPreAggregation = modifier_on
+ context = HogQLContext(
+ team_id=team.pk,
+ team=team,
+ enable_select_queries=True,
+ modifiers=modifiers,
+ )
+ prepared_ast = prepare_ast_for_printing(node=parse(query), context=context, dialect="clickhouse")
+ if prepared_ast is None:
+ return ""
+ return print_prepared_ast(prepared_ast, context=context, dialect="clickhouse", pretty=True)
+
+ @parameterized.expand([("on", True), ("off", False)])
+ def test_url_filter_with_channel_type_breakdown(self, _name: str, modifier_on: bool):
+ # The shape that motivated this fix: a single-column session filter ($entry_current_url)
+ # alongside a multi-column session breakdown ($channel_type) — without the modifier the
+ # raw_sessions GROUP BY materializes ~7 channel-source columns for every session in the
+ # date range, which OOMs on large teams.
+ query = """
+SELECT
+ count() AS total,
+ events.session.$channel_type AS chan
+FROM events
+WHERE events.event = '$pageview'
+ AND events.timestamp >= '2026-03-01 00:00:00'
+ AND events.timestamp <= '2026-03-31 23:59:59'
+ AND match(events.session.$entry_current_url, 'http')
+GROUP BY chan
+"""
+ actual = self.print_query(query, modifier_on=modifier_on)
+ normalized = " ".join(actual.split())
+ has_pre_agg = (
+ "in(raw_sessions.session_id_v7" in normalized or "globalIn(raw_sessions.session_id_v7" in normalized
+ )
+ assert has_pre_agg == modifier_on, f"Expected pre-agg={modifier_on}; got:\n{actual}"
+
+ if modifier_on:
+ # Small inner must materialize entry_url (used by predicate) but NOT the channel-source
+ # columns (used only by $channel_type in the outer SELECT). Counts: entry_url goes from
+ # 1 → 2 (outer + small inner); initial_utm_source stays at its outer-only count.
+ off_normalized = " ".join(self.print_query(query, modifier_on=False).split())
+ assert (
+ normalized.count("argMinMerge(raw_sessions.entry_url)")
+ == off_normalized.count("argMinMerge(raw_sessions.entry_url)") + 1
+ ), "Expected entry_url to appear once more (in the small inner) with pre-agg on"
+ assert normalized.count("argMinMerge(raw_sessions.initial_utm_source)") == off_normalized.count(
+ "argMinMerge(raw_sessions.initial_utm_source)"
+ ), "Expected initial_utm_source count unchanged — small inner must not materialize channel columns"
+
+ def test_pre_agg_with_two_session_columns_in_filter(self):
+ # AND of two session predicates: small inner must aggregate both columns, not just one.
+ # The breakdown still drags in the full $channel_type machinery, so the outer is still
+ # heavy — but the small inner stays narrow.
+ query = """
+SELECT
+ count() AS total,
+ events.session.$channel_type AS chan
+FROM events
+WHERE events.event = '$pageview'
+ AND events.timestamp >= '2026-03-01 00:00:00'
+ AND events.timestamp <= '2026-03-31 23:59:59'
+ AND match(events.session.$entry_current_url, 'http')
+ AND events.session.$entry_referring_domain != 'spam.example.com'
+GROUP BY chan
+"""
+ actual = self.print_query(query, modifier_on=True)
+ normalized = " ".join(actual.split())
+ has_pre_agg = (
+ "in(raw_sessions.session_id_v7" in normalized or "globalIn(raw_sessions.session_id_v7" in normalized
+ )
+ assert has_pre_agg, f"Expected pre-agg; got:\n{actual}"
+
+ # Small inner aggregates both filter columns. entry_url: 1 (outer) + 1 (small) = 2.
+ # initial_referring_domain is shared between the channel-source machinery (outer) and the
+ # small inner — counting all occurrences confirms the small inner pulled it in.
+ off_normalized = " ".join(self.print_query(query, modifier_on=False).split())
+ assert (
+ normalized.count("argMinMerge(raw_sessions.entry_url)")
+ == off_normalized.count("argMinMerge(raw_sessions.entry_url)") + 1
+ )
+ assert normalized.count("argMinMerge(raw_sessions.initial_referring_domain)") > off_normalized.count(
+ "argMinMerge(raw_sessions.initial_referring_domain)"
+ ), "Expected initial_referring_domain to appear more often with pre-agg on (small inner adds it)"
+ # Pure channel-only columns (not in the filter) must not leak into the small inner.
+ assert normalized.count("argMinMerge(raw_sessions.initial_utm_source)") == off_normalized.count(
+ "argMinMerge(raw_sessions.initial_utm_source)"
+ ), "Expected initial_utm_source count unchanged — small inner must not materialize unreferenced channel columns"
+
+ def test_no_pre_agg_when_no_session_filter(self):
+ query = """
+SELECT count(), events.session.$channel_type AS chan
+FROM events
+WHERE events.event = '$pageview'
+ AND events.timestamp >= '2026-03-01 00:00:00'
+GROUP BY chan
+"""
+ actual = self.print_query(query, modifier_on=True)
+ normalized = " ".join(actual.split())
+ assert "in(raw_sessions.session_id_v7" not in normalized, f"Expected no pre-agg; got:\n{actual}"
+ assert "globalIn(raw_sessions.session_id_v7" not in normalized, f"Expected no pre-agg; got:\n{actual}"
diff --git a/posthog/hogql/database/schema/util/where_clause_extractor.py b/posthog/hogql/database/schema/util/where_clause_extractor.py
index a90952f2e240..db20b0936cb4 100644
--- a/posthog/hogql/database/schema/util/where_clause_extractor.py
+++ b/posthog/hogql/database/schema/util/where_clause_extractor.py
@@ -1,5 +1,6 @@
import random
import string
+from collections.abc import Callable
from datetime import datetime
from typing import Optional, cast
@@ -616,6 +617,74 @@ def build_session_id_v7_pushdown_predicate(
)
+def build_session_property_pre_aggregation_predicate(
+ outer_node: ast.SelectQuery,
+ join_to_add: LazyJoinToAdd,
+ context: HogQLContext,
+ requested_fields: dict[str, list[str | int]],
+ select_from_fn: Callable[[dict[str, list[str | int]], ast.SelectQuery, HogQLContext], ast.SelectQuery],
+ session_id_v7_field: ast.Expr,
+) -> Optional[ast.Expr]:
+ """Build ``raw_sessions.session_id_v7 IN (SELECT session_id_v7 FROM <small inner> WHERE <session predicate>)``.
+
+ The "small inner" is a recursive call to ``select_from_fn`` (the same builder) with a pruned
+ ``requested_fields`` containing only the session aliases referenced by the predicate. That
+ keeps the small inner's GROUP BY hash table cheap — one or two AggregateFunction states per
+ session instead of however many the outer SELECT pulls in (e.g. ``$channel_type`` drags in
+ 7+).
+
+ Returns None when ``WhereClauseExtractor`` produces no liftable session predicate (no session
+ filter, or only filters guarded by NOT/OR with non-session terms — see the visitor's tombstone
+ handling). The predicate-references-outer-fields check is a defensive belt; in practice
+ ``requested_fields`` already contains every session alias the outer query references, so
+ extraction guarantees a non-empty intersection.
+ """
+ extractor = WhereClauseExtractor(context)
+ extractor.add_local_tables(join_to_add)
+ lifted = extractor.get_inner_where(outer_node)
+ if lifted is None or isinstance(lifted, ast.Constant):
+ return None
+
+ referenced_aliases = _collect_referenced_top_level_aliases(lifted)
+ referenced_in_outer = referenced_aliases & {name for name in requested_fields if name != "session_id_v7"}
+ if not referenced_in_outer:
+ return None
+
+ pruned_fields: dict[str, list[str | int]] = {name: requested_fields[name] for name in referenced_in_outer}
+ pruned_fields["session_id_v7"] = ["session_id_v7"]
+
+ small_inner = select_from_fn(pruned_fields, outer_node, context)
+
+ wrapped = ast.SelectQuery(
+ select=[ast.Field(chain=["session_id_v7"])],
+ select_from=ast.JoinExpr(table=small_inner),
+ where=lifted,
+ )
+
+ return ast.CompareOperation(
+ op=CompareOperationOp.In,
+ left=session_id_v7_field,
+ right=wrapped,
+ )
+
+
+def _collect_referenced_top_level_aliases(expr: ast.Expr) -> set[str]:
+ visitor = _CollectTopLevelAliasesVisitor()
+ visitor.visit(expr)
+ return visitor.names
+
+
+class _CollectTopLevelAliasesVisitor(TraversingVisitor):
+ names: set[str]
+
+ def __init__(self):
+ self.names = set()
+
+ def visit_field(self, node: ast.Field):
+ if node.chain:
+ self.names.add(str(node.chain[0]))
+
+
def _find_join_for_alias(select_from: Optional[ast.JoinExpr], alias: str) -> Optional[ast.JoinExpr]:
ptr = select_from
while ptr:
diff --git a/posthog/hogql/modifiers.py b/posthog/hogql/modifiers.py
index acbb790ae0ac..a3587cfb64af 100644
--- a/posthog/hogql/modifiers.py
+++ b/posthog/hogql/modifiers.py
@@ -116,6 +116,9 @@ def set_default_modifier_values(modifiers: HogQLQueryModifiers, team: "Team"):
if modifiers.sessionIdPushdown is None:
modifiers.sessionIdPushdown = False
+ if modifiers.sessionPropertyPreAggregation is None:
+ modifiers.sessionPropertyPreAggregation = False
+
def set_default_in_cohort_via(modifiers: HogQLQueryModifiers) -> HogQLQueryModifiers:
if modifiers.inCohortVia is None or modifiers.inCohortVia == InCohortVia.AUTO:
diff --git a/posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py b/posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py
index ae64884d1494..a2d3fa89fd59 100644
--- a/posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py
+++ b/posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py
@@ -2883,6 +2883,86 @@ class TestTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):
assert modifiers.inCohortVia == InCohortVia.AUTO
+ @parameterized.expand(
+ [
+ ("flag_off_no_breakdown", False, None, False),
+ (
+ "flag_off_session_multi",
+ False,
+ BreakdownFilter(breakdowns=[Breakdown(type=MultipleBreakdownType.SESSION, property="$channel_type")]),
+ False,
+ ),
+ ("flag_on_no_breakdown", True, None, False),
+ (
+ "flag_on_event_multi",
+ True,
+ BreakdownFilter(breakdowns=[Breakdown(type=MultipleBreakdownType.EVENT, property="$browser")]),
+ False,
+ ),
+ (
+ "flag_on_session_multi",
+ True,
+ BreakdownFilter(breakdowns=[Breakdown(type=MultipleBreakdownType.SESSION, property="$channel_type")]),
+ True,
+ ),
+ (
+ "flag_on_session_legacy",
+ True,
+ BreakdownFilter(breakdown_type=BreakdownType.SESSION, breakdown="$channel_type"),
+ True,
+ ),
+ (
+ "flag_on_event_legacy",
+ True,
+ BreakdownFilter(breakdown_type=BreakdownType.EVENT, breakdown="$browser"),
+ False,
+ ),
+ ]
+ )
+ @patch("posthog.hogql_queries.insights.trends.trends_query_runner.posthoganalytics.feature_enabled")
+ def test_session_property_pre_aggregation_modifier_gate(
+ self,
+ _name: str,
+ flag_enabled: bool,
+ breakdown_filter: Optional[BreakdownFilter],
+ expected: bool,
+ patch_feature_enabled,
+ ):
+ patch_feature_enabled.return_value = flag_enabled
+ runner = TrendsQueryRunner(
+ team=self.team,
+ query=TrendsQuery(series=[EventsNode(event="$pageview")], breakdownFilter=breakdown_filter),
+ )
+ assert runner.modifiers.sessionPropertyPreAggregation is expected
+
+ @patch("posthog.hogql_queries.insights.trends.trends_query_runner.posthoganalytics.feature_enabled")
+ def test_session_property_pre_aggregation_modifier_clears_on_dashboard_reapply(self, patch_feature_enabled):
+ # apply_dashboard_filters re-runs __post_init__. The modifier must reflect the *current*
+ # query state, not the initial one — so a session-breakdown query that gets overridden
+ # with an event breakdown must clear the modifier back to False.
+ from posthog.schema import DashboardFilter
+
+ patch_feature_enabled.return_value = True
+ runner = TrendsQueryRunner(
+ team=self.team,
+ query=TrendsQuery(
+ series=[EventsNode(event="$pageview")],
+ breakdownFilter=BreakdownFilter(
+ breakdowns=[Breakdown(type=MultipleBreakdownType.SESSION, property="$channel_type")]
+ ),
+ ),
+ )
+ assert runner.modifiers.sessionPropertyPreAggregation is True
+
+ runner.apply_dashboard_filters(
+ DashboardFilter(
+ breakdown_filter=BreakdownFilter(
+ breakdowns=[Breakdown(type=MultipleBreakdownType.EVENT, property="$browser")]
+ )
+ )
+ )
+ assert runner.modifiers.sessionPropertyPreAggregation is False
+
def test_raises_for_empty_series(self):
query_runner = TrendsQueryRunner(
team=self.team,
diff --git a/posthog/hogql_queries/insights/trends/trends_query_runner.py b/posthog/hogql_queries/insights/trends/trends_query_runner.py
index c5b5fb28e352..f0a7e9ad6b03 100644
--- a/posthog/hogql_queries/insights/trends/trends_query_runner.py
+++ b/posthog/hogql_queries/insights/trends/trends_query_runner.py
@@ -10,6 +10,7 @@ from django.conf import settings
from django.db import models
from django.db.models.functions import Coalesce
+import posthoganalytics
from natsort import natsorted, ns
from posthog.schema import (
@@ -844,6 +845,34 @@ class TrendsQueryRunner(AnalyticsQueryRunner[TrendsQueryResponse]):
self.modifiers.dataWarehouseEventsModifiers = datawarehouse_modifiers
+ self.modifiers.sessionPropertyPreAggregation = (
+ self._has_session_breakdown() and self._team_flag_session_property_pre_aggregation()
+ )
+
+ def _has_session_breakdown(self) -> bool:
+ filter = self.query.breakdownFilter
+ if filter is None:
+ return False
+ if filter.breakdown_type == "session":
+ return True
+ return any(breakdown.type == "session" for breakdown in (filter.breakdowns or []))
+
+ def _team_flag_session_property_pre_aggregation(self) -> bool:
+ return posthoganalytics.feature_enabled(
+ "trends-session-property-pre-aggregation",
+ str(self.team.uuid),
+ groups={
+ "organization": str(self.team.organization_id),
+ "project": str(self.team.id),
+ },
+ group_properties={
+ "organization": {"id": str(self.team.organization_id)},
+ "project": {"id": str(self.team.id)},
+ },
+ only_evaluate_locally=False,
+ send_feature_flag_events=False,
+ )
+
def setup_series(self) -> list[SeriesWithExtras]:
series_with_extras = [
SeriesWithExtras(
diff --git a/posthog/hogql_queries/test/test_query_runner.py b/posthog/hogql_queries/test/test_query_runner.py
index ca90bda89899..643cb85ee045 100644
--- a/posthog/hogql_queries/test/test_query_runner.py
+++ b/posthog/hogql_queries/test/test_query_runner.py
@@ -217,6 +217,7 @@ class TestQueryRunner(BaseTest):
"personsArgMaxVersion": PersonsArgMaxVersion.AUTO,
"personsOnEventsMode": PersonsOnEventsMode.PERSON_ID_OVERRIDE_PROPERTIES_JOINED,
"sessionIdPushdown": False,
+ "sessionPropertyPreAggregation": False,
"sessionTableVersion": SessionTableVersion.AUTO,
"sessionsV2JoinMode": SessionsV2JoinMode.UUID,
"useMaterializedViews": True,
@@ -298,7 +299,7 @@ class TestQueryRunner(BaseTest):
runner = TestQueryRunner(query={"some_attr": "bla"}, team=team)
cache_key = runner.get_cache_key()
- assert cache_key == "cache_42_68a2c8e2bf539173ac6e464a103418bb433834fbce3157ed121192f403d69a0c"
+ assert cache_key == "cache_42_13ab830e775c41ee3ae4b45c386e6064d74eec55fb93092732c0bb305d7e980f"
def test_cache_key_runner_subclass(self):
TestQueryRunner = self.setup_test_query_runner_class()
@@ -312,7 +313,7 @@ class TestQueryRunner(BaseTest):
runner = TestSubclassQueryRunner(query={"some_attr": "bla"}, team=team)
cache_key = runner.get_cache_key()
- assert cache_key == "cache_42_4eb789b3c70480ba14a762c56a648f2bf7a117a3c31b60ed3c5cb826444ddf4c"
+ assert cache_key == "cache_42_b624e873acbdc9829f0973b4dc14424bb26e3b5c36c11387ce24e9ff3bea2a00"
def test_cache_key_different_timezone(self):
TestQueryRunner = self.setup_test_query_runner_class()
@@ -323,7 +324,7 @@ class TestQueryRunner(BaseTest):
runner = TestQueryRunner(query={"some_attr": "bla"}, team=team)
cache_key = runner.get_cache_key()
- assert cache_key == "cache_42_f67778c870f29df1c38c85726fd6f2b319b920f6f3414acf2de1927271503977"
+ assert cache_key == "cache_42_473689ec17cc982383519776503e498bd0e44f16e6b6f0073412599254a69aba"
@mock.patch("django.db.transaction.on_commit")
def test_cache_response(self, mock_on_commit):
diff --git a/posthog/schema.py b/posthog/schema.py
index 2e398440686d..2fe5d512ade3 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -7127,6 +7127,16 @@ class HogQLQueryModifiers(BaseModel):
" participate in the outer events filter."
),
)
+ sessionPropertyPreAggregation: bool | None = Field(
+ default=None,
+ description=(
+ "Pre-filter raw_sessions aggregation by `session_id_v7 IN (cheap"
+ " pre-aggregation that only materializes the columns referenced by the"
+ " outer-WHERE session predicate)`. Useful when the breakdown/SELECT pulls"
+ " in many session columns (e.g. `$channel_type`) but the filter only"
+ " references one (e.g. `$entry_current_url`)."
+ ),
+ )
sessionTableVersion: SessionTableVersion | None = None
sessionsV2JoinMode: SessionsV2JoinMode | None = None
timings: bool | None = None
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index 92ffbade4d71..ebb37c60efb5 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -461,6 +461,11 @@ export interface HogQLQueryModifiersApi {
* @nullable
*/
sessionIdPushdown?: boolean | null
+ /**
+ * Pre-filter raw_sessions aggregation by `session_id_v7 IN (cheap pre-aggregation that only materializes the columns referenced by the outer-WHERE session predicate)`. Useful when the breakdown/SELECT pulls in many session columns (e.g. `$channel_type`) but the filter only references one (e.g. `$entry_current_url`).
+ * @nullable
+ */
+ sessionPropertyPreAggregation?: boolean | null
sessionTableVersion?: SessionTableVersionApi | null
sessionsV2JoinMode?: SessionsV2JoinModeApi | null
/** @nullable */
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 06e727fd86dd..5de1a6919c71 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -1695,6 +1695,11 @@ export namespace Schemas {
* @nullable
*/
sessionIdPushdown?: boolean | null;
+ /**
+ * Pre-filter raw_sessions aggregation by `session_id_v7 IN (cheap pre-aggregation that only materializes the columns referenced by the outer-WHERE session predicate)`. Useful when the breakdown/SELECT pulls in many session columns (e.g. `$channel_type`) but the filter only references one (e.g. `$entry_current_url`).
+ * @nullable
+ */
+ sessionPropertyPreAggregation?: boolean | null;
sessionTableVersion?: SessionTableVersion | null;
sessionsV2JoinMode?: SessionsV2JoinMode | null;
/** @nullable */