[MDEV-20283] Optimizer bug when making INNER JOIN with Foreign Keys Created: 2019-08-08 Updated: 2019-08-08 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.4.7 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vitaly Radchik | Assignee: | Igor Babaev |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | optimizer | ||
| Environment: |
Debian 9.2, Core i7-7700k, 32G RAM |
||
| Attachments: |
|
| Description |
|
It seems that optimizer fails when executing INNER JOIN select when tables are related by a foreign key. There are 3 tables:
The default_work has about 200,000 records, default_subject - 42, and default_worktype - 12 When executing this query:
I got about 9 seconds of execution time, with explain says what no primary key is used. But when I deleted foreign keys and appropriate indexes - the query runs fast and smooth. (Both explain results shown in attached images). |