optimizer_search_depth

Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value.

See also: System Variables for MariaDB Enterprise Server 10.6, in 10.5 ES, and in 10.4 ES

USAGE

The optimizer_search_depth system variable can have its default value configured via SkySQL Configuration Manager.

DETAILS

The optimizer_search_depth system variable sets the maximum depth that the optimizer will search when determining an optimal query plan:

  • When it is set to higher values, the optimizer can determine better query plans when executing queries with a lot of joins. However, this can also cause the optimizer to take too long to determine the query plan, so the trade-off is not always worthwhile.

  • When it is set to lower values, the optimizer can spend less time determining a query plan, but the resulting query plan may not be the most optimal.

  • When it is set to 0, the optimizer tries to pick a reasonable search depth. Currently, it does this by setting the search depth to the number of tables used in the query, up to a maximum value of 7.

PARAMETERS

Dynamic

Yes

Scope

Global, Session

Data Type

BIGINT UNSIGNED

Minimum Value

0

Maximum Value

62

Default Value

62

SKYSQL

Cloud

SkySQL Topology

ES Ver

Default

AWS

HA (Primary/Replica)

10.4

62 (choices: 0, 8, 16, 32, 48, 56, 62)

AWS

HA (Primary/Replica)

10.5

62 (choices: 0, 8, 16, 32, 48, 56, 62)

AWS

Transactional Standalone

10.4

62 (choices: 0, 8, 16, 32, 48, 56, 62)

AWS

Transactional Standalone

10.5

62 (choices: 0, 8, 16, 32, 48, 56, 62)

AWS

Distributed Transactions

10.5

Not present (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

ColumnStore

10.5

62 (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

ColumnStore Multi

10.5

62 (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

Galera

10.4

62 (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

Galera

10.5

62 (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

HA (Primary/Replica)

10.4

62 (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

HA (Primary/Replica)

10.5

62 (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

HTAP

10.5

62 (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

Transactional Standalone

10.4

62 (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

Transactional Standalone

10.5

62 (choices: 0, 8, 16, 32, 48, 56, 62)

GCP

Distributed Transactions

10.5

Not present (choices: 0, 8, 16, 32, 48, 56, 62)

PRIVILEGES

The optimizer_search_depth system variable requires the SUPER privilege to dynamically set its global value at runtime.

The optimizer_search_depth system variable does not require any special privilege to dynamically set its session value at runtime.

CHANGE HISTORY

Release Series

History

10.6 Enterprise

  • Present starting in MariaDB Enterprise Server 10.6.4-1.

10.5 Enterprise

  • Present starting in MariaDB Enterprise Server 10.5.3-1.

10.4 Enterprise

  • Present starting in MariaDB Enterprise Server 10.4.6-1.

EXTERNAL REFERENCES