Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-13301

Optimize DROP INDEX, ADD INDEX into RENAME INDEX

Details

    Description

      MDEV-7318 is requesting SQL syntax for ALTER TABLEā€¦RENAME INDEX, similar to MySQL 5.7.

      One could use DROP INDEX, ADD INDEX to simulate RENAME INDEX, but that will currently cause InnoDB to rebuild the index. The index rebuild should be optimized away, and only the index should be renamed. The InnoDB source code for renaming indexes exists starting with MariaDB 10.2, but it is disabled.

      InnoDB should allow ALGORITHM=INSTANT operation for DROP INDEX, ADD INDEX when there is no actual data change. If an index is marked as corrupted, it would be nice to refuse ALGORITHM=INSTANT and actually rebuild the index.

      Attachments

        Issue Links

          Activity

            novergaard Nicklas Laine Overgaard created issue -
            ivolucien Ivo Havener added a comment -

            This looks like a duplicate of MDEV-7318 - https://jira.mariadb.org/browse/MDEV-7318

            And +1

            ivolucien Ivo Havener added a comment - This looks like a duplicate of MDEV-7318 - https://jira.mariadb.org/browse/MDEV-7318 And +1
            marko Marko MƤkelƤ made changes -
            Field Original Value New Value
            Summary Support for alter table rename index Optimize DROP INDEX, ADD INDEX into RENAME INDEX
            marko Marko MƤkelƤ made changes -
            Issue Type Task [ 3 ] Bug [ 1 ]
            marko Marko MƤkelƤ made changes -
            marko Marko MƤkelƤ made changes -
            marko Marko MƤkelƤ made changes -
            marko Marko MƤkelƤ made changes -
            Component/s Data Definition - Alter Table [ 10114 ]
            Component/s Storage Engine - InnoDB [ 10129 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Affects Version/s 10.3.0 [ 22127 ]
            Affects Version/s 10.2.2 [ 22013 ]
            Description MySQL 5.7 added an extension to the SQL syntax that allows renaming indexes without dropping and creating the index:
            https://dev.mysql.com/doc/refman/5.7/en/alter-table.html

            I hit the missing support by accident as the dotnet core entity framework provider for mysql creates RENAME INDEX queries when renaming an index, which breaks the migrations.
            MDEV-7318 is requesting SQL syntax for {{ALTER TABLEā€¦RENAME INDEX}}, [similar to MySQL 5.7|https://dev.mysql.com/doc/refman/5.7/en/alter-table.html].

            One could use {{DROP INDEX}}, {{ADD INDEX}} to simulate {{RENAME INDEX}}, but that will currently cause InnoDB to rebuild the index. The index rebuild should be optimized away, and only the index should be renamed. The InnoDB source code for renaming indexes exists starting with MariaDB 10.2, but it is disabled.

            InnoDB should allow {{ALGORITHM=INSTANT}} operation for {{DROP INDEX}}, {{ADD INDEX}} when there is no actual data change. If an index is marked as corrupted, it would be nice to refuse {{ALGORITHM=INSTANT}} and actually rebuild the index.
            Labels instant

            I repurposed this ticket for a something similar that does not involve syntax changes.

            marko Marko MƤkelƤ added a comment - I repurposed this ticket for a something similar that does not involve syntax changes.
            marko Marko MƤkelƤ made changes -
            Comment [ I repurposed this ticket for a something similar that does not involve syntax changes. ]
            marko Marko MƤkelƤ made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            kevg Eugene Kosov (Inactive) made changes -
            Assignee Eugene Kosov [ kevg ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Attachment rename_index+varchar_length.patch [ 46681 ]

            I attached the patch which does rename for add index & drop index which contains same column and same prefix.
            Patch which does it inside innodb. (Patch also contains indexed varchar column changes). I hope it could be useful.
            rename_index+varchar_length.patch

            It is based on 10.2

            thiru Thirunarayanan Balathandayuthapani added a comment - I attached the patch which does rename for add index & drop index which contains same column and same prefix. Patch which does it inside innodb. (Patch also contains indexed varchar column changes). I hope it could be useful. rename_index+varchar_length.patch It is based on 10.2
            kevg Eugene Kosov (Inactive) made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]
            kevg Eugene Kosov (Inactive) made changes -
            Assignee Eugene Kosov [ kevg ] Marko MƤkelƤ [ marko ]
            Status In Progress [ 3 ] In Review [ 10002 ]

            I would like to move the rename detection to the SQL layer, so that index renaming can be done instantly on a wider selection of storage engines.

            marko Marko MƤkelƤ added a comment - I would like to move the rename detection to the SQL layer, so that index renaming can be done instantly on a wider selection of storage engines.
            marko Marko MƤkelƤ made changes -
            Assignee Marko MƤkelƤ [ marko ] Eugene Kosov [ kevg ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            kevg Eugene Kosov (Inactive) made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]

            Patch changed. Seems to work.

            kevg Eugene Kosov (Inactive) added a comment - Patch changed. Seems to work.
            kevg Eugene Kosov (Inactive) made changes -
            Assignee Eugene Kosov [ kevg ] Marko MƤkelƤ [ marko ]
            Status In Progress [ 3 ] In Review [ 10002 ]

            serg, can you please review the changes outside InnoDB?

            marko Marko MƤkelƤ added a comment - serg , can you please review the changes outside InnoDB?
            marko Marko MƤkelƤ made changes -
            Assignee Marko MƤkelƤ [ marko ] Sergei Golubchik [ serg ]

            Note for myself. After the fix for MDEV-17376 lands it'll be worth look at it and check how much impact it will have on this issue.

            kevg Eugene Kosov (Inactive) added a comment - Note for myself. After the fix for MDEV-17376 lands it'll be worth look at it and check how much impact it will have on this issue.
            kevg Eugene Kosov (Inactive) made changes -
            serg Sergei Golubchik made changes -
            Fix Version/s 10.3 [ 22126 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Eugene Kosov [ kevg ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            kevg Eugene Kosov (Inactive) made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]

            PR rebased to 10.4

            kevg Eugene Kosov (Inactive) added a comment - PR rebased to 10.4
            kevg Eugene Kosov (Inactive) made changes -
            Assignee Eugene Kosov [ kevg ] Sergei Golubchik [ serg ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Eugene Kosov [ kevg ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            kevg Eugene Kosov (Inactive) made changes -
            Assignee Eugene Kosov [ kevg ] Sergei Golubchik [ serg ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Status In Review [ 10002 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.4.4 [ 23310 ]
            Fix Version/s 10.4 [ 22408 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Eugene Kosov [ kevg ]
            marko Marko MƤkelƤ made changes -
            marko Marko MƤkelƤ made changes -
            marko Marko MƤkelƤ made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 81646 ] MariaDB v4 [ 152469 ]
            mariadb-jira-automation Jira Automation (IT) made changes -
            Zendesk Related Tickets 114030

            People

              kevg Eugene Kosov (Inactive)
              novergaard Nicklas Laine Overgaard
              Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.