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

ALTER TABLE re-creating vector key is no-op with non-copying alter algorithms (default)

    XMLWordPrintable

Details

    Description

      create table t (v vector(1) not null, vector(v) distance=euclidean);
      insert into t values (0x31313131); # Optional, fails either way
      alter table t drop index v, add vector(v) distance=cosine;
      show create table t;
       
      # Cleanup
      drop table t;
      

      6038e1babcdfd2c7762dc83a3256afefc0985b84

      alter table t drop index v, add vector(v) distance=cosine;
      show create table t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `v` vector(1) NOT NULL,
        VECTOR KEY `v` (`v`) `distance`=euclidean
      ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
      

      With more data, when index creation normally takes noticeable time, the operation above remains instantaneous, so I suppose it doesn't just preserve the old attribute, but really doesn't do anything.

      Workarounds are

      • use ALGORITHM=COPY, or
      • do it in 2 steps, ALTER .. DROP INDEX followed by ALTER .. ADD VECTOR.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              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.