Skip to content

Conversation

@qiancai
Copy link
Owner

@qiancai qiancai commented Sep 29, 2025

First-time contributors' checklist

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions (in Chinese).

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • New Features
    • Introduced system variable tidb_opt_selectivity_factor (SESSION/GLOBAL, persisted). Configurable via SET_VAR hints. Float [0, 1], default 0.8. Used by the optimizer as a fallback selectivity. Available since v9.0.0.
  • Documentation
    • Added documentation for tidb_opt_selectivity_factor, including scope, defaults, range, and usage cautions.

@gemini-code-assist
Copy link

Summary of Changes

Hello @qiancai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances TiDB's query optimization and execution capabilities by introducing a new system variable for optimizer selectivity and enabling per-operator concurrency controls. These changes aim to provide more precise control over query performance, especially in scenarios lacking statistics, and are accompanied by updated documentation to assist users in configuration.

Highlights

  • New System Variable: tidb_opt_selectivity_factor: Introduced the tidb_opt_selectivity_factor system variable, configurable at SESSION/GLOBAL scope and persistent, to control the default optimizer selectivity when statistics are unavailable.
  • Per-Operator Executor Concurrency Controls: Added fine-grained concurrency controls for specific operators including index lookup, index lookup join, hash join, hash aggregation partial/final, projection, and window, providing more granular tuning options alongside tidb_executor_concurrency.
  • Documentation Update: Updated the system variables reference documentation to include detailed information and guidance for the newly introduced optimizer selectivity and executor concurrency settings.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request appears to contain a temporary file, temp.md, which seems unrelated to the intended changes described in the pull request description (updating system-variables.md). My review suggests that this file should likely be removed. I have also included a minor stylistic suggestion to add a trailing newline, which is a common convention for text files.

@github-actions
Copy link

🤖 Auto-sync completed successfully

📥 Source PR: qiancai/docs-cn#15
🎯 Target PR: #45
✅ English documentation has been updated based on Chinese documentation changes.

This comment was generated automatically by the sync workflow.

  Synced from: qiancai/docs-cn#15
  Target PR: #45
  AI Provider: gemini

  Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@coderabbitai
Copy link

coderabbitai bot commented Sep 29, 2025

Walkthrough

Adds documentation for a new system variable tidb_opt_selectivity_factor in system-variables.md, detailing scope, type, range, default, description, and version introduced.

Changes

Cohort / File(s) Summary
Docs: System variables
system-variables.md
Documented new variable tidb_opt_selectivity_factor (SESSION/GLOBAL, persisted). Type: Float [0,1], default 0.8. Describes optimizer fallback selectivity and SET_VAR control. Marked introduced in v9.0.0. Positioned near related optimizer/selectivity entries.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

I twitch my whiskers, nibble on lore,
A fresh knob appears—optimizer core.
From zero to one, a careful factor,
0.8 by default, a steady actor.
I thump in docs, hop line to line—
Selectivity set, plans align. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description includes only the empty template headings and leaves the required “What is changed, added or deleted?” and version selection sections blank, and the CLA checklist is unchecked. Without details on the changes made, their rationale, and the applicable TiDB versions, reviewers lack the necessary context to assess the update. Although a related PR link is provided, the core documentation of the change is missing. Please complete the description by explaining what was changed and why in the “What is changed, added or deleted?” section, select the affected TiDB version(s), and confirm the CLA checklist so that reviewers have a clear and complete context for the PR.
Title Check ❓ Inconclusive The title “Update system-variables.md” merely names the file being changed without summarizing the substantive update, which is the addition of a new system variable tidb_opt_selectivity_factor. As a result, it does not clearly convey the primary change to reviewers. A more descriptive title is needed to reflect the key enhancement introduced by the PR. Please revise the title to succinctly describe the main change, for example “Add tidb_opt_selectivity_factor system variable to system-variables.md,” so that the essence of the update is immediately clear to reviewers.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test-add-a-variable-15

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
system-variables.md (1)

1797-1799: Align metadata labels with existing style

The nearby sections label these fields as “Persists to cluster: …” and “Applies to hint SET_VAR”. Please reuse the same wording here so the table stays uniform.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 322c671 and 95bd177.

📒 Files selected for processing (1)
  • system-variables.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md

⚙️ CodeRabbit configuration file

As a technical writer in the database area, you need to first learn the changes in this PR, and then improve the content to make it clear, concise, and easy to understand in English according to your database knowledge.

Files:

  • system-variables.md

@qiancai qiancai closed this Sep 29, 2025
@qiancai qiancai deleted the test-add-a-variable-15 branch September 29, 2025 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants