[MDEV-30759] Slow query due to Optimizer picking the wrong table for join order Created: 2023-03-01 Updated: 2023-03-01 Resolved: 2023-03-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.6.12 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Patrick Thomas | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 22.04 (10.6.12-MariaDB-0ubuntu0.22.04.1-log) |
||
| Attachments: |
|
| Description |
|
We have two big tables (> 1 and 10 mio entries). Query looks like this:
After upgrade to MariaDB 10.6 (From 10.3) the query optimizer is not able to choose the correct order (See screenshots and dump). Dump needed to get reduced to get it uploaded to Jira (10MB). Expected: Result: This causes our statement(s) to significantly loose performance (from 0.5sec to 9sec) |
| Comments |
| Comment by Daniel Black [ 2023-03-01 ] |
|
Does running analyze table on both result in a different query plan? Can you attach a analyze format=json $query as text for the query and datasets you have running. |
| Comment by Patrick Thomas [ 2023-03-01 ] |
|
I attached the analyse results |
| Comment by Patrick Thomas [ 2023-03-01 ] |
|
ANALYZE TABLE assets, asset_media PERSISTENT FOR ALL; Resulted in attached screenshot which seem to have fixed the problem!! Thanks so much! |