[MDEV-7317] Make an index ignorable to the optimizer Created: 2014-12-14 Updated: 2021-08-05 Resolved: 2021-03-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Data Definition - Create Table, Optimizer |
| Fix Version/s: | 10.6.0 |
| Type: | Task | Priority: | Critical |
| Reporter: | James Briggs | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 11 |
| Labels: | index, optimizer | ||
| Issue Links: |
|
||||||||||||||||
| Description |
| Comments |
| Comment by James Briggs [ 2014-12-15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here's the syntax I've implemented in the parser:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by James Briggs [ 2014-12-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The Oracle 11g documentation is fuzzy on whether invisible indexes are session or global or both. If anybody has any thoughts on that, please add a comment. In MySQL, various index properties are scoped like this: set foreign_key_checks (session or global) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by luntik2012 [ 2018-10-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
mysql has visible keyword now, so even not still broken mariadb 10.1 is incompatible with mysql | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Colm Smyth [ 2018-12-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Upvoting this issue as it blocks compatibility with recent versions of MySQL Workbench, and as it is a straightforward feature that has already been prototyped. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2020-04-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
colm_smyth, you can configure a target mysql version in workbench preferences. Set it to 5.7 to get a compatible dump. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2020-04-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
varun, we cannot really call them INVISIBLE, because we already use the concept of invisibility for something completely different. Perhaps, "IGNORED"? That exactly explains what they are, and also matches the IGNORE INDEX syntax in the FROM clause. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rick James [ 2020-05-04 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
While I understand that IGNORE is a better keyword than INVISIBLE, I worry that MariaDB's incompatibility with MySQL will be made worse. It means that transferring some datasets between MariaDB and MySQL, in either direction, will lead to errors fixable only by hand-editing of the dump. Perhaps a partial solution is for loading the file can accept either keyword. Or a commandline switch can allow for ignoring the conflicting keyword. Note that Workbench raised the problem by adding [unnecessarily] "VISIBLE" when making dumps. "mysqldump" should not include VISIBLE. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Colm Smyth [ 2020-05-04 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There is no logical conflict between the concept of an invisible column (to SELECT) and an invisible (to the optimizer) index. If there is no syntactic issue, it would be better to use the same INVISIBLE keyword to maximise compatibility with MySQL as it is important for MariaDB to be able to simplify migration and adoption for former MySQL users. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2020-05-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
rjasdfiii, VISIBLE is already silently parsed and ignored after colm_smyth, unfortunately, there is. Currently invisible indexes are indexes that only index invisible columns. There can be columns so invisible to the user that even SHOW CREATE TABLE doesn't show then, and indexes that index them are not shown either. Although they're perfectly "visible" to the optimizer and it is allowed to use them to optimize the query. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rick James [ 2020-05-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks, Colm and Sergei. In addition to the invisible index on an invisible column, I can think of two others: The hidden 6-byte PK that InnoDB uses as a last resort. And the extra column added for InnoDB FULLTEXT. That's 3 cases. Is there a list somewhere of all such odd indexes? Perhaps such a list would be made as a checklist on whether all cases are being handled for this feature request and other situations. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2020-05-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The patch is in the branch 10.5-mdev7317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2021-02-24 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Review input provided: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2021-05-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Note:
This hasn't been implemented. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2021-08-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi ralf.gebhardt@mariadb.com, right. We did not add an optimizer switch flag for this. |