optimizer_search_depth
This page is part of MariaDB's Documentation.
The parent of this page is: System Variables for MariaDB Enterprise Server
Topics on this page:
Overview
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.
USAGE
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
Command-line | --optimizer_search_depth=# |
Configuration file | Supported |
Dynamic | Yes |
Scope | Global, Session |
Data Type | BIGINT UNSIGNED |
Minimum Value | 0 |
Maximum Value | 62 |
Product Default Value | 62 |
SKYSQL
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.