[MDEV-21352] Performance issues for select queries with wrong data type Created: 2019-12-18 Updated: 2023-04-27 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Daniel Häller | Assignee: | Igor Babaev |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian 9, MariaDB 10.1.26 (and higher) |
||
| Description |
|
After upgrading to version 10.1.26 from 10.0.32 we have performance issues caused by select queries where we use strings as parameters instead of the correct data type ints. In earlier versions MariaDB/MySQL handled the wrong strings as if it were ints and executed the queries in the same manner. If we change the parameters to ints instead of strings in 10.1.26 the queries executes as in 10.0.32. In our case the issue causes I/O-problems due to creation of tmp disk tables (Created_tmp_disk_tables increments by 1 every time the query is executed). The problem has been reproduced in newer versions of MariaDB as well. Tables/data to reproduce the problem:
Query to reproduce the problem (notice string for a.b_id instead of integer):
Explain extended, version 10.1.26: select sql_no_cache `test`.`a`.`b_id` AS `b_id`,`test`.`a`.`value` AS `value` from `test`.`a` join `test`.`b` join `test`.`c` where ((`test`.`b`.`id` = `test`.`a`.`b_id`) and (`test`.`a`.`c_id` = '1') and (`test`.`a`.`b_id` = '1')) group by `test`.`a`.`b_id` Explain, extended, version 10.0.32: select sql_no_cache `test`.`a`.`b_id` AS `b_id`,`test`.`a`.`value` AS `value` from `test`.`a` join `test`.`b` join `test`.`c` where ((`test`.`a`.`b_id` = 1) and (`test`.`a`.`c_id` = '1') and (`test`.`a`.`b_id` = '1')) group by `test`.`a`.`b_id` |