Hi all :wave: My experiment analysis on the Manage...
# ask-questions
e
Hi all ๐Ÿ‘‹ My experiment analysis on the Managed Warehouse (GrowthBook Cloud) recently started failing without any config changes on my end. Every metric update for my experiment now errors with: โ–Ž Error Processing Query Results โ–Ž Resolved identifier 'd.guild_id' in parent scope to expression 'd.guild_id AS guild_id' with correlated columns 'guild_id' (Enable 'allow_experimental_correlated_subqueries' setting to allow correlated subqueries execution). In scope __factTable AS m. Some details: - The failing query is the fact-metric query ("Fact Table: Events (Guilds) โ€” Query 1 of 2"). The Traffic/Health query (Query 2) still runs fine, so exposure data is flowing normally. - I use a custom identifier guild_id, extracted in the exposure query and fact table as attributes.guild_id::Nullable(String). - This experiment analyzed fine before, it broke at some point without me touching the experiment, metric, or fact table definitions. - Since it's the Managed Warehouse, I can't enable allow_experimental_correlated_subqueries myself. It looks like the ClickHouse analyzer is treating the generated __userMetricJoin โ†’ LEFT JOIN __factTable m ON (m.guild_id = d.guild_id) as containing a correlated reference. Possibly related to the native JSON attributes migration? Full generated SQL for the failing query in the thread ๐Ÿงต. Happy to share my experiment/org ID via DM if that helps. Thanks!
Copy code
-- Fact Table: Events (Guilds)
WITH
  __rawExperiment AS (
    SELECT
      *,
      attributes.guild_id:: Nullable(String) AS guild_id
    FROM
      experiment_views
    WHERE
      experiment_id LIKE 'premium-promo-button-label'
      AND timestamp BETWEEN '2026-02-03 02:10:00' AND '2026-07-10 03:43:56'
  ),
  __experimentExposures AS (
    -- Viewed Experiment
    SELECT
      e.guild_id as guild_id,
      toString(e.variation_id) as variation,
      e.timestamp as timestamp
    FROM
      __rawExperiment e
    WHERE
      e.experiment_id = 'premium-promo-button-label'
      AND e.timestamp >= toDateTime('2026-02-03 02:10:00', 'UTC')
      AND e.timestamp <= toDateTime('2026-07-10 03:43:56', 'UTC')
  ),
  __experimentUnits AS (
    -- One row per user
    SELECT
      e.guild_id AS guild_id,
      if(
        count(distinct e.variation) > 1,
        '__multiple__',
        max(e.variation)
      ) AS variation,
      MIN(e.timestamp) AS first_exposure_timestamp
    FROM
      __experimentExposures e
    GROUP BY
      e.guild_id
  ),
  __distinctUsers AS (
    SELECT
      guild_id,
      variation,
      first_exposure_timestamp AS timestamp,
      dateTrunc('day', first_exposure_timestamp) AS first_exposure_date
    FROM
      __experimentUnits
  ),
  __factTable as (
    -- Fact Table (Events (Guilds))
    SELECT
      guild_id as guild_id,
      m.timestamp as timestamp,
      -- Premium Promo Click
      CASE
        WHEN ((event_name = 'Premium Promo Click')) THEN 1
        ELSE NULL
      END as m0_value
    FROM
      (
        SELECT
          *,
          guild_id
        FROM
          events
        WHERE
          timestamp BETWEEN '2026-02-03 02:10:00' AND '2026-07-10 03:43:56'
      ) m
    WHERE
      m.timestamp >= toDateTime('2026-02-03 02:10:00', 'UTC')
      AND m.timestamp <= toDateTime('2026-07-10 03:43:56', 'UTC')
      AND (event_name = 'Premium Promo Click')
  ),
  __userMetricJoin as (
    SELECT
      d.variation AS variation,
      d.timestamp AS timestamp,
      d.guild_id AS guild_id,
      if(
        m.timestamp >= d.timestamp
        AND m.timestamp <= toDateTime('2026-07-10 03:43:56', 'UTC'),
        m.m0_value,
        NULL
      ) as m0_value
    FROM
      __distinctUsers d
      LEFT JOIN __factTable m ON (m.guild_id = d.guild_id)
  ),
  __userMetricAgg as (
    -- Add in the aggregate metric value for each user
    SELECT
      umj.variation,
      umj.guild_id,
      COALESCE(MAX(umj.m0_value), 0) AS m0_value
    FROM
      __userMetricJoin umj
    GROUP BY
      umj.variation,
      umj.guild_id
  )
  -- One row per variation/dimension with aggregations
SELECT
  m.variation AS variation,
  COUNT(*) AS users,
  toString('fact__19g6mml5yl3lg') as m0_id,
  SUM(COALESCE(m.m0_value, 0)) AS m0_main_sum,
  SUM(POWER(COALESCE(m.m0_value, 0), 2)) AS m0_main_sum_squares
FROM
  __userMetricAgg m
GROUP BY
  m.variation
w
Hello ๐Ÿ‘‹, GrowthBook support here. I found your account and looked into your setup on GrowthBook cloud. Your "*Events (Guilds*)" fact table has its own separate SQL definition from your main "*Events*" fact table. When your account's identifier handling migrated to JSON attributes, the main Events table got auto-updated to alias
guild_id
correctly, but "*Events (Guilds)*" didnโ€™t. It's still running
SELECT *, guild_id FROM events
, which no longer resolves cleanly against the current schema and is what's confusing ClickHouse's analyzer into reporting a correlated subquery. Fix: update the SQL Definition on "*Events (Guilds)*" to:
Copy code
SELECT *, attributes.guild_id::Nullable(String) AS guild_id
FROM events
WHERE timestamp BETWEEN '{{startDate}}' AND '{{endDate}}'
That's the expression your main Events table already uses. This should fix the issue. I hope this helps.
e
thank you! Ill give it a try