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(experiments): set grace_hash_join_initial_buckets=2 for mean metric queries (#58792)

Anders3d085c5487d9
diff --git a/posthog/hogql/constants.py b/posthog/hogql/constants.py
index 1167cfa33826..45913d15704e 100644
--- a/posthog/hogql/constants.py
+++ b/posthog/hogql/constants.py
@@ -117,6 +117,7 @@ class HogQLQuerySettings(BaseModel):
date_time_output_format: Optional[str] = None
date_time_input_format: Optional[str] = None
join_algorithm: Optional[str] = None
+ grace_hash_join_initial_buckets: Optional[int] = None
force_data_skipping_indices: Optional[list[str]] = None
load_balancing: Optional[str] = None
format_csv_allow_double_quotes: Optional[bool] = None
diff --git a/posthog/hogql_queries/experiments/experiment_query_runner.py b/posthog/hogql_queries/experiments/experiment_query_runner.py
index f457979b072f..8028fc1bd7b0 100644
--- a/posthog/hogql_queries/experiments/experiment_query_runner.py
+++ b/posthog/hogql_queries/experiments/experiment_query_runner.py
@@ -408,6 +408,7 @@ class ExperimentQueryRunner(QueryRunner):
# can exceed memory with the default hash join. grace_hash spills to disk when needed.
if isinstance(self.metric, ExperimentMeanMetric):
settings.join_algorithm = "grace_hash"
+ settings.grace_hash_join_initial_buckets = 2
response = execute_hogql_query(
query_type="ExperimentQuery",
diff --git a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_base.ambr b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_base.ambr
index c0cc16c820d6..a8d5b16fdeca 100644
--- a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_base.ambr
+++ b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_base.ambr
@@ -56,6 +56,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -126,6 +127,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -189,6 +191,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -252,6 +255,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -322,6 +326,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -392,6 +397,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -462,6 +468,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -532,6 +539,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -602,6 +610,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -672,6 +681,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -742,6 +752,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -812,6 +823,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -882,6 +894,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -952,6 +965,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1022,6 +1036,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1092,6 +1107,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1162,6 +1178,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1232,6 +1249,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1302,6 +1320,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1372,6 +1391,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1442,6 +1462,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1502,6 +1523,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1562,6 +1584,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1622,6 +1645,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1682,6 +1706,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1742,6 +1767,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1805,6 +1831,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1865,6 +1892,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1938,6 +1966,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1998,6 +2027,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2066,6 +2096,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2126,6 +2157,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2186,6 +2218,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2246,6 +2279,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2316,6 +2350,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2386,6 +2421,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2456,6 +2492,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2526,6 +2563,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2596,6 +2634,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2659,6 +2698,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2729,6 +2769,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -2799,6 +2840,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
diff --git a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_breakdown.ambr b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_breakdown.ambr
index a40869351376..2a64d0960207 100644
--- a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_breakdown.ambr
+++ b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_breakdown.ambr
@@ -353,6 +353,7 @@
GROUP BY entity_metrics.variant,
entity_metrics.breakdown_value_1
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -429,6 +430,7 @@
GROUP BY entity_metrics.variant,
entity_metrics.breakdown_value_1
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -505,6 +507,7 @@
GROUP BY entity_metrics.variant,
entity_metrics.breakdown_value_1
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -592,6 +595,7 @@
GROUP BY entity_metrics.variant,
entity_metrics.breakdown_value_1
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -674,6 +678,7 @@
entity_metrics.breakdown_value_1,
entity_metrics.breakdown_value_2
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -761,6 +766,7 @@
GROUP BY entity_metrics.variant,
entity_metrics.breakdown_value_1
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -849,6 +855,7 @@
entity_metrics.breakdown_value_2,
entity_metrics.breakdown_value_3
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -931,6 +938,7 @@
entity_metrics.breakdown_value_1,
entity_metrics.breakdown_value_2
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1020,6 +1028,7 @@
GROUP BY winsorized_entity_metrics.variant,
winsorized_entity_metrics.breakdown_value_1
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1102,6 +1111,7 @@
entity_metrics.breakdown_value_1,
entity_metrics.breakdown_value_2
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1189,6 +1199,7 @@
GROUP BY entity_metrics.variant,
entity_metrics.breakdown_value_1
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
diff --git a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.ambr b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.ambr
index ad7bf9e60d41..7ba436999787 100644
--- a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.ambr
+++ b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.ambr
@@ -40,6 +40,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -191,6 +192,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -246,6 +248,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -301,6 +304,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -356,6 +360,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -411,6 +416,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -466,6 +472,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -521,6 +528,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -576,6 +584,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -631,6 +640,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -696,6 +706,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -761,6 +772,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -816,6 +828,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -871,6 +884,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -926,6 +940,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -981,6 +996,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1036,6 +1052,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1094,6 +1111,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1149,6 +1167,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1217,6 +1236,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1272,6 +1292,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1335,6 +1356,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1390,6 +1412,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1445,6 +1468,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1500,6 +1524,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
@@ -1571,6 +1596,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
format_csv_allow_double_quotes=1,
readonly=2,
max_execution_time=600,
diff --git a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_frequentist_method.ambr b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_frequentist_method.ambr
index f50e8d6ac8ad..bdeead393c1d 100644
--- a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_frequentist_method.ambr
+++ b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_frequentist_method.ambr
@@ -56,6 +56,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
diff --git a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_mean_metric.ambr b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_mean_metric.ambr
index cb0001bbe7ce..438039466481 100644
--- a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_mean_metric.ambr
+++ b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_mean_metric.ambr
@@ -56,6 +56,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -109,6 +110,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -180,6 +182,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -233,6 +236,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -304,6 +308,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -357,6 +362,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -438,6 +444,7 @@
FROM winsorized_entity_metrics
GROUP BY winsorized_entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -501,6 +508,7 @@
FROM winsorized_entity_metrics
GROUP BY winsorized_entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -573,6 +581,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -627,6 +636,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -708,6 +718,7 @@
FROM winsorized_entity_metrics
GROUP BY winsorized_entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -771,6 +782,7 @@
FROM winsorized_entity_metrics
GROUP BY winsorized_entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -852,6 +864,7 @@
FROM winsorized_entity_metrics
GROUP BY winsorized_entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -915,6 +928,7 @@
FROM winsorized_entity_metrics
GROUP BY winsorized_entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -996,6 +1010,7 @@
FROM winsorized_entity_metrics
GROUP BY winsorized_entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1059,6 +1074,7 @@
FROM winsorized_entity_metrics
GROUP BY winsorized_entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -1130,6 +1146,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1183,6 +1200,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -1254,6 +1272,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1307,6 +1326,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -1378,6 +1398,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1431,6 +1452,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -1502,6 +1524,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1555,6 +1578,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
@@ -1626,6 +1650,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,
@@ -1679,6 +1704,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
load_balancing='in_order',
readonly=2,
max_execution_time=600,
diff --git a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_session_properties.ambr b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_session_properties.ambr
index 0082de5f638e..5a3ded87472d 100644
--- a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_session_properties.ambr
+++ b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_session_properties.ambr
@@ -71,6 +71,7 @@
FROM entity_metrics
GROUP BY entity_metrics.variant
LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
readonly=2,
max_execution_time=600,
allow_experimental_object_type=1,