[MDEV-17825] EXPLAIN new index suggestion mode Created: 2018-11-25 Updated: 2022-04-14 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Sergei Golubchik | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | energy | ||
| Issue Links: |
|
||||||||||||
| Description |
|
When optimizer considers different indexes for a query, for every index it needs to know
Note that the first question doesn't need the index to be created. And the other two can be answered from EITS, so they don't need an index either. So, the optimizer should, technically, be able to create an execution plan that uses an index, even if the index does not exist! This could be incorporated into a new explain mode, say EXPLAIN SUGGEST_INDEXES that will return what indexes (if created) would reduce the query execution cost and how. |
| Comments |
| Comment by Rick James [ 2021-12-13 ] |
|
I have a prototype; it takes only a SELECT and generates suggestions for each table in a JOIN. With more information, it could
|
| Comment by Sergei Golubchik [ 2021-12-14 ] |
|
what kind of a prototype, in SQL? |
| Comment by Rick James [ 2021-12-14 ] |
|
PHP with regexps. It would probably be much harder with just SQL. A parse tree would help a lot. |