[MDEV-25196] Slow Query, when using LOCATE String Function Created: 2021-03-19 Updated: 2021-03-23 Resolved: 2021-03-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.5.9 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Wayne Forrest | Assignee: | Sergei Golubchik |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | generated, locate, slow | ||
| Environment: |
MacOS BigSur 11.2.3 (20D91) |
||
| Description |
|
I have a MariaDB Generated column and when using LOCATE to query the field, the query is slow, examining all the rows.
CREATE TEST TABLE
CREATE TEST PROCEDURE
STORE 100,000 Records
TEST QUERY 1
TEST QUERY 2
CORRECTION _I have realised that I have used the LOCATE function incorrect below, however this does not explain why the queries are slow; The correct usage of LOCATE
|
| Comments |
| Comment by Sergei Golubchik [ 2021-03-23 ] |
|
The server cannot use indexes for a column used in LOCATE(). Generated or not. If your only condition is LOCATE it'll mean a full table scan. |