Sign InTry Free

Optimizer Fix Controls

As the product evolves iteratively, the behavior of the TiDB optimizer changes, which in turn generates more reasonable execution plans. However, in some particular scenarios, the new behavior might lead to unexpected results. For example:

  • The effect of some behaviors relies on a specific scenario. Changes that bring improvements to most scenarios might cause regressions to others.
  • Sometimes, the relationship between changes in the behavior details and their consequences is very complicated. An improvement in a certain behavior might cause overall regression.

Therefore, TiDB provides the Optimizer Fix Controls feature that allows you to make fine-grained control of TiDB optimizer behaviors by setting values for a group of fixes. This document describes the Optimizer Fix Controls feature and how to use them, and lists all the fixes that TiDB currently supports for Optimizer Fix Controls.

Introduction to tidb_opt_fix_control

Starting from v7.1.0, TiDB provides the tidb_opt_fix_control system variable to control the behavior of the optimizer in a more fine-grained way.

Each fix is a control item used to adjust the behavior in the TiDB optimizer for one particular purpose. It is denoted by a number that corresponds to a GitHub Issue that contains the technical details of the behavior change. For example, for fix 44262, you can review what it controls in Issue 44262.

The tidb_opt_fix_control system variable accepts multiple fixes as one value, separated by commas (,). The format is "<#issue1>:<value1>,<#issue2>:<value2>,...,<#issueN>:<valueN>", where <#issueN> is the fix number. For example:

SET SESSION tidb_opt_fix_control = '44262:ON,44389:ON';

Optimizer Fix Controls reference

44262 New in v7.2.0

  • Default value: OFF
  • Possible values: ON, OFF
  • This variable controls whether to allow the use of Dynamic pruning mode to access the partitioned table when the GlobalStats are missing.

44389 New in v7.2.0

  • Default value: OFF
  • Possible values: ON, OFF
  • For filters such as c = 10 and (a = 'xx' or (a = 'kk' and b = 1)), this variable controls whether to try to build more comprehensive scan ranges for IndexRangeScan.
Download PDF
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2023 PingCAP. All Rights Reserved.