Ilia Torua
11/19/2026, 11:52 AMRocky
11/19/2026, 11:53 AMcompute_table_stats?
Partially confirmable. The system variable enable_iceberg_column_statistics is documented as: "Whether to obtain column statistics, such as min, max, null count, row size, and ndv (if a puffin file exists). When this item is set to false, only the row count information will be collected." Default false, introduced v3.4 — so it exists in 3.5.
That wording implies StarRocks reads NDV from a Puffin statistics file when one is present. Iceberg statistics files are exactly what compute_table_stats writes, so this is plausibly compatible.
What I could not confirm: that 3.5.19 reads statistics files written by the Spark procedure (as opposed to Iceberg's own writer), which Puffin sketch encoding it accepts, or any 3.5.19-specific behavior. Neither the docs nor the source lookup gave me that. Treat "yes" as a hypothesis to test with the procedure in §5, not a guarantee.
2. Are the settings sufficient, and what scope applies?
• enable_iceberg_column_statistics — system variable, session scope (default false). This is the one you actually must turn on. Set it with SET in the session, or SET GLOBAL so new sessions inherit it. Introduced v3.4.
• enable_read_iceberg_puffin_ndv — system variable, boolean, default true, present in branches 3.5/4.0/4.1/4.2/main. Note: the official docs do not describe it; the only confirmation is the source-level name lookup. Since it defaults to true, it is not required for your setup unless something set it to false.
• enable_get_stats_from_external_metadata — I could not verify this exists. No doc, FE-config entry or source-name lookup returned it, and the Iceberg catalog property docs don't list it. Do not put it in a CREATE/ALTER CATALOG statement until you've confirmed the name against the source of your 3.5.19 build (grep CatalogProperties / IcebergCatalogProperties in the FE source) — an unknown catalog property is at best silently ignored, at worst rejected.
So minimally: SET enable_iceberg_column_statistics = true; (and leave enable_read_iceberg_puffin_ndv at its default).
3. Do stale StarRocks ANALYZE stats take precedence?
Likely yes, but I did not find a 3.5-specific statement of the precedence rule. The one piece of evidence I found is a 4.1.7 fix description: rows whose coverage metadata is unusable "fall back to the connector's own table statistics" — implying StarRocks-collected statistics (_statistics_.external_column_statistics) are primary and connector/metadata statistics are the fallback. That is 4.1-era wording, not a 3.5 doc guarantee.
To force Iceberg metadata statistics to be used, the documented tools are:
• DROP STATS <table> (listed in the external-table collection section), so there are no stored StarRocks rows to win the precedence contest;
• SET enable_query_trigger_analyze = false so no new rows get created.
I could not confirm whether 3.5.19's fallback actually consults Puffin once stored stats exist but are stale — test it rather than assume.
4. Can you disable enable_query_trigger_analyze and rely on Iceberg metadata + Puffin?
Yes as a mechanism — enable_query_trigger_analyze is a session variable (default true, introduced v3.4), and metadata-derived statistics (row count, `min`/`max`, null_count, value counts) are always available; Puffin adds NDV only when enable_iceberg_column_statistics = true.
Remaining optimizer limitations (documented):
• No histograms on external tables other than Hive — histogram collection "is only supported on Hive external tables". So no skew/MCV information for Iceberg.Rocky
11/19/2026, 11:53 AMconnector_table_query_trigger_analyze_max_pending_task_num, default 100 — and an FE restart clearing it) matches a known issue logging trigger skip | table_uuid=... reason=running_task, fixed in 4.1.7 and 4.0.17, with no 3.5 backport. If that's your bug, disabling query-triggered ANALYZE is a workaround, not a fix; upgrading is the documented fix.
5. Verifying that a query actually uses the Spark NDV
Caveat first: on 3.5.19 the query profile's per-table StatsSource is not a reliable indicator. A known issue makes it report NONE for Iceberg metadata-based scans even when the estimate is correct; fixed in 4.1.4, no backport to 3.5.
Minimal procedure:
1. Spark side: run compute_table_stats for customer_id, account_id as in your example, then confirm a statistics file was actually committed to the table metadata (check the Iceberg metadata JSON for a statistics entry / query the Iceberg statistics metadata table from Spark). Without a committed statistics file there is nothing for StarRocks to read.
2. StarRocks, clear the competing stats:
sql
SELECT * FROM _statistics_.external_column_statistics
WHERE table_name = 'transactions'; -- expect rows if ANALYZE ran
DROP STATS lake.db.transactions;
SET enable_query_trigger_analyze = false;
SET enable_iceberg_column_statistics = true;
3. Refresh metadata so the new snapshot/statistics file is visible: REFRESH EXTERNAL TABLE lake.db.transactions; (the cached table entry otherwise reloads on iceberg_table_cache_refresh_interval_sec, default 60s; iceberg_meta_cache_ttl_sec defaults to 86400).
4. Read the estimate: EXPLAIN LOGICAL / EXPLAIN VERBOSE on a query whose cost depends on the NDV, e.g. a group-by or join on customer_id, and compare the scan/aggregate Estimates: {row: ...} before vs. after the Spark run. A change tracking the Spark NDV is your positive signal; no change means either the file isn't consumed or stored stats still win.
5. Cross-check: SHOW STATS META WHERE table = 'transactions' to confirm no StarRocks-collected stats remain for the table.
──────────
What I could not confirm, summarized: existence of `enable_get_stats_from_external_metadata`; that 3.5.19 reads Spark-written Puffin sketches and which encoding; the exact precedence rule between external_column_statistics and connector statistics on 3.5; multi-column/external applicability of joint NDV. For those, check branch-3.5 source (IcebergMetadata, IcebergTableStatistic*, CatalogProperties) or ask in the StarRocks community Slack/forum.
References
• using_starrocks/Cost_based_optimizer.md
• data_source/feature-support-data-lake-analytics.md
• data_source/catalog/iceberg/iceberg.md
• administration/configuration/FE_parameters/stats_storage.md
• administration/configuration/FE_parameters/user_query_loading.md
• administration/configuration/FE_parameters/shared_lake_other.mdIlia Torua
11/19/2026, 11:57 AMRocky
11/19/2026, 11:57 AMbranch-3.5 but was not yet released there as of 2026-11-11 — it is slated for the next 3.5 patch release. So 3.5.19 does not have it.
• Symptom: query-triggered statistics collection for external tables gets permanently stuck; every log line for the affected table reports the trigger being skipped because a task is running, while the analyze pool sits idle (0 active, 0 queued) and global dictionary updates stop too. Only an FE restart recovers it.
• Log signature: trigger skip | table_uuid=... reason=running_task
• Trigger conditions: query-triggered analyze on external tables; more than one analyze task for the same table; analyze thread pool full (n threads plus a queue of n); running-concurrency limit reached (default 2).
• Fix mechanism: stops the analyze queue from overwriting or leaking running-task entries and keeps the periodic scheduler alive after an error.
• Workaround on affected versions: restarting the FE (only thing that recovered it).
Caveat on your specific observation: you describe the pending queue reaching 100 (connector_table_query_trigger_analyze_max_pending_task_num, default 100, confirmed in the FE config docs). The known issue describes the opposite shape — pool idle at 0 active / 0 queued with running_task skips. They may be the same underlying leak observed at different moments, but I can't confirm that from the docs. Check your FE log for the literal reason=running_task string: if it's there, this is your bug.
One nuance: I could not find PR #80329 listed in the 4.1.7 release-notes bug-fix text I retrieved (that list includes a different analyze item, #81028 "An analyze job stopped collecting the remaining tables after one table failed"). The fix is documented in the known-issues record rather than the release-notes passage. The 3.5.20 release notes I retrieved also did not show #80329, but that passage was truncated, so I can't confirm whether 3.5.20 includes it — check the 3.5.20 release notes for #80329 directly before planning an upgrade.
Second correction: the StatsSource issue
Confirmed as I said, with the PR now identified: 4.1.4 bug fix _"Iceberg/Delta metadata-derived statistics are now tagged with `StatsSource=TABLE_METADATA`"_ — #76560. Known issue: no backport on 4.0 or 3.5. So on 3.5.19, a profile showing StatsSource = NONE for an Iceberg scan tells you nothing about whether the metadata estimate was used — my §5 advice to judge by EXPLAIN row estimates rather than the profile label stands.
Net effect on your plan
Disabling enable_query_trigger_analyze on 3.5.19 is still the right workaround for the stall, and it's consistent with moving NDV collection to Spark. But it does not fix the underlying FE bug, which is still present in 3.5.19 and reaches you in a later 3.5 patch. Note that turning the trigger off also stops the low-cardinality dictionary updates that the same scheduler drives (per the known-issue description), so watch for plan changes on low-cardinality columns.
Nothing else in my earlier answer changes: enable_iceberg_column_statistics (session var, default false, v3.4+) is the switch that matters; enable_read_iceberg_puffin_ndv exists in source with default true but is undocumented; enable_get_stats_from_external_metadata I still cannot confirm exists; and whether 3.5.19 actually parses Spark-written Puffin sketches remains unverified — that still needs the empirical check.Rocky
11/19/2026, 11:57 AMIlia Torua
11/19/2026, 12:05 PMRocky
11/19/2026, 12:06 PMenable_get_stats_from_external_metadata is documented. It's in the official Iceberg catalog docs: "Whether to obtain statistics from Iceberg metadata", default false, catalog property, v3.4+. My "could not verify this exists" was flatly wrong, and worse, I advised you not to set it — the one setting that is a hard prerequisite. The doc entry also states that when it's true, a session variable of the same name further controls which statistics type is collected.
• enable_iceberg_column_statistics alone is insufficient — consistent with the doc phrasing that the catalog property gates the whole metadata-statistics path ("Starting from v3.4, StarRocks can obtain statistics of Iceberg tables by reading Iceberg metadata through setting the following parameters").
The other three I accept on your evidence: APACHE_DATASKETCHES_THETA_V1 + single column field ID + numeric ndv property; MetadataMgr checking StarRocks-collected statistics first with connector metadata as fallback; and PR #80342 merged to branch-3.5 on 2026-10-09 (my "no 3.5 backport" was wrong twice over — I'd also cited #80329 rather than #80342, so possibly a fix plus backport pair).
One caveat I can't resolve: whether 3.5.19 specifically contains #80342 depends on that tag's cut date relative to 2026-10-09, which I don't have. Check the 3.5.19 release notes or git tag --contains on the commit before assuming the stall is fixed.
Revised answers
1. Puffin NDV consumption — yes. The reader accepts APACHE_DATASKETCHES_THETA_V1 blobs with one column field ID and an ndv property, and Iceberg's Spark compute_table_stats writer emits exactly that. Your "Spark writer vs Iceberg's own writer" distinction was the right correction: compute_table_stats is Iceberg's Spark implementation, so there's no compatibility gap to hypothesize about. Also note the reader reads the scalar NDV from registered blob metadata rather than deserializing the sketch — so what matters is that the ndv property is present and numeric, not sketch-payload compatibility.
2. Settings — all three are needed, at different scopes:
Setting | Scope | Default | Role
enable_get_stats_from_external_metadata | catalog property (CREATE/ALTER CATALOG) | false | Hard gate; false returns default stats before the column-statistics reader is reached
enable_get_stats_from_external_metadata | session variable (same name) | — | Further selects which statistics type to collect
enable_iceberg_column_statistics | session variable | false | Enables column stats incl. NDV from Puffin; false = row count only
enable_read_iceberg_puffin_ndv | session variable | true | Toggles the Puffin NDV path
So: catalog property plus SET enable_iceberg_column_statistics = true. Your set was right; my answer telling you to drop the catalog property was the thing that would have broken it.
3. Precedence — StarRocks-collected statistics win, and staleness is irrelevant. The selection checks whether statistics are unknown, not their timestamp. Old-but-known StarRocks statistics keep precedence indefinitely, so waiting for staleness never promotes the metadata path. DROP STATS is the only way to vacate the slot — I previously implied staleness might matter, which was wrong and would have made your test silently measure nothing.Rocky
11/19/2026, 12:06 PMenable_query_trigger_analyze — viable, with caveats. Remaining limitations: histograms on external tables are Hive-only, so no skew/MCV info for Iceberg; multi-column joint NDV is manual-collection-only and I can't confirm external/Iceberg support; NDV is approximate. And disabling the trigger also stops the low-cardinality dictionary updates that share the scheduler — watch for plan regressions on low-cardinality columns.
5. Also correct: metadata metrics are not "always available." They depend on collection settings and on which metrics Iceberg actually recorded per column. If the table was written with metrics disabled (e.g. write.metadata.metrics.default=none), there is no min/max/null-count/NDV to read regardless of your StarRocks settings.
Minimal validation procedure (revised ordering)
sql
-- 0. FIRST: stop collection, or inspecting stats will enqueue more work
SET enable_query_trigger_analyze = false;
-- 1. Gate the catalog property
ALTER CATALOG lake SET ("enable_get_stats_from_external_metadata" = "true");
-- 2. Vacate StarRocks-collected stats (staleness alone won't do it)
SELECT * FROM _statistics_.external_column_statistics WHERE table_name = 'transactions';
DROP STATS lake.db.transactions;
-- 3. Enable column stats; leave the Puffin switch at default true
SET enable_iceberg_column_statistics = true;
SET enable_read_iceberg_puffin_ndv = true;
-- 4. Pick up the new statistics file
REFRESH EXTERNAL TABLE lake.db.transactions;
Then, on one controlled table:
1. In Spark, run compute_table_stats for customer_id, `account_id`; confirm a statistics entry was actually committed to the table metadata JSON.
2. In StarRocks, confirm the table's Iceberg column metrics exist (record count, per-column null counts, bounds). If not, stop — nothing will be consumed.
3. EXPLAIN LOGICAL a query whose estimate depends on NDV (group-by or join on customer_id). Record Estimates: {row: ...}.
4. SET enable_read_iceberg_puffin_ndv = false; and re-run the same EXPLAIN. The delta between steps 3 and 4 is your positive signal — it isolates the Puffin NDV contribution from min/max/row-count. No delta means the blob isn't being read (wrong field ID, missing ndv property, or stale metadata).
5. Do not use the profile's StatsSource label on 3.5.19 — it reports NONE for metadata-based Iceberg scans (PR #76560, no 3.5 backport).
Still genuinely unverified
The session-variable value semantics of enable_get_stats_from_external_metadata (docs say it selects statistics type, but I didn't retrieve its accepted values), and whether 3.5.19's tag contains #80342. Both are worth confirming against your build before rollout.
References
• data_source/catalog/iceberg/iceberg.md
• sql-reference/System_variable.md
• using_starrocks/Cost_based_optimizer.md
• data_source/feature-support-data-lake-analytics.md
References
• administration/configuration/FE_parameters/user_query_loading.md
• using_starrocks/Cost_based_optimizer.md
• administration/configuration/FE_parameters/stats_storage.md
• data_source/catalog/iceberg/iceberg.md
• knowledge/qa/statistics_collection.md (StarRocks knowledge base)
• sql-reference/System_variable.md