[MDEV-30964] MAX_SEL_ARGS memory exhaustion is not visible in the optimizer trace Created: 2023-03-29 Updated: 2023-09-07 Resolved: 2023-06-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.4 |
| Fix Version/s: | 10.8.8, 10.4.31, 10.5.22, 10.6.15, 10.9.8, 10.10.6, 10.11.5, 11.0.3, 11.1.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Description |
|
It is possible to construct queries that hit the MAX_SEL_ARG=16000 limit in the range optimizer. Unfortunately, this limit is only visible in debugger. It is trivial print hitting this limit into the optimizer trace. |
| Comments |
| Comment by Sergei Petrunia [ 2023-03-29 ] | ||||||||||||||||
|
Note: starting from 10.5 and fix for examples:
| ||||||||||||||||
| Comment by Sergei Petrunia [ 2023-03-29 ] | ||||||||||||||||
|
Johnston could you review this? | ||||||||||||||||
| Comment by Sergei Petrunia [ 2023-08-22 ] | ||||||||||||||||
|
MAX_SEL_ARGS is "the maximum number of SEL_ARG objects that may be allocated during range analysis" (range analysis is performed on a per-table basis) . max_sel_arg_weight is a user-visible variable. It is "the maximum weight of a SEL_ARG graph that the optimizer may construct". The definitions of SEL_ARG graph and its weight are rather convoluted. If the optimizer allocated N SEL_ARG objects, the SEL_ARG graph it constructed may have a weight that's less, equal, or greater than N. | ||||||||||||||||
| Comment by Sergei Petrunia [ 2023-08-22 ] | ||||||||||||||||
|
Note: Optimizer trace will get these keywords for hitting the weight limit:
The patch for this MDEV added:
| ||||||||||||||||
| Comment by Sergei Petrunia [ 2023-08-22 ] | ||||||||||||||||
|
Summary for documentation: The optimizer may cause high memory usage or long processing time when analyzing complex WHERE clauses. |