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

ALTER TABLE t ADD COLUMN c INT, ADD INDEX(c), ALGORITHM=NOCOPY fails

    XMLWordPrintable

Details

    Description

      When MDEV-11369 implemented instant ADD COLUMN, it would refuse to do instant ADD together with ADD INDEX.

      Adding an index to an instantly added column does not make much sense, because the index would be useless due to every row initially having the same value for the instantly added column.

      However, it is meaningful to ADD COLUMN together with ADD INDEX on some old column. This will currently cause the table to be rebuilt:

      --source include/have_innodb.inc
      create table t1(a int) engine=innodb;
      alter table t1 add column b int, add index(a), algorithm=nocopy;
      alter table t1 add column c int, add index(c), algorithm=nocopy;
      drop table t1;
      

      The first ALTER TABLE should be fixed to allow ALGORITHM=NOCOPY, but the second one can in my opinion continue to rebuild the table with ALGORITHM=INPLACE.

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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