← Back to Pull requests

[improvement](statistics) Configure scanner concurrency for statistics SQL #70938

Closed
unknown closed this pull request without merging on Nov 27, 2026 10:53 UTC
View on GitHub
unknown unknown commented on Nov 24, 2026 07:39 UTC
Author

Background

Manual and automatic statistics collection run SQL in a dedicated FE connection context. This context starts with the global session defaults and then applies statistics-specific resource settings for SQL memory and pipeline instances. The BE has separate scanner concurrency settings for table scans and file scans.

What problem does this PR solve?

Issue Number: None
Related PR: None
PR Type: Enhancement

Problem Summary:

Operators who need to reduce scanner concurrency for statistics collection currently have to lower the corresponding global session defaults, which also affect ordinary queries. Two separate FE settings let administrators tune statistics SQL at runtime for Doris tables and file scans. Both default to one scanner per scan instance. Set either to zero to restore inheritance from the corresponding global session variable.

Details

  • Before and after: Statistics SQL previously inherited both scanner settings. A positive FE setting now overrides the corresponding value in the internal statistics query options.

  • Configs and defaults: statistics_sql_max_scanners_concurrency applies to ordinary scan operators such as OLAP table scans. statistics_sql_max_file_scanners_concurrency applies to file scan operators. Both default to 1 and accept values from 0 through 256. Set either to 0 to inherit its global session default. They can be changed on a running FE and take effect for newly created statistics query contexts.

  • Impact on existing users: Built-in inherited defaults on the base revision are 4 for ordinary scans and 16 for file scans. After upgrade, statistics SQL defaults to one scanner per scan instance. Set the associated FE setting to 0 to retain the previous inheritance behavior. Ordinary query sessions continue to obtain values from the existing session variables.
  • Testing

  • ConfigTest, StatisticsUtilTest, and SessionVariableParallelismTest passed locally (36 FE unit tests). They cover the default of one, independent overrides, inheritance, and invalid settings at runtime and startup.
  • Notes for Reviewers

    Both overrides are applied in the context builder already used by statistics SQL, alongside its execution-instance and memory settings. The startup validator runs after both FE configuration files are read and uses the same range check as dynamic config updates. The limit matches the existing query session limit.

    Release note

    Statistics collection now defaults to one scanner per scan instance for Doris tables and file-backed external tables. The two limits can be configured independently. Set either limit to zero to inherit the corresponding global session default.

    Check List (For Author)

  • Behavior changed: Yes (see Details)

  • Does this need documentation: Yes (document both settings in the FE configuration and statistics collection guides)

  • Pre-submission status: Partially verified: FE build, style and focused tests passed. BE scanner counts were not measured on a cluster.
  • Diff: 379 lines (+284 / -95) across 4 files Reviewer: morrySnow Review duration: 4514m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.66) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.66 · 379 lines diff across 4 files
    0.66
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.355
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.066
    Real PR Conversation Timeline
    1 comments
    "Review active on #70938"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 66.1% (HIGH) · Higher = larger blast radius
    66.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.1% · Safe to merge
    26.1%
    Repository