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

ANALYZE doesn't analyze vector indexes

    XMLWordPrintable

Details

    Description

      Spawned from MDEV-40954 upon discussion in the comments.

      InnoDB statistics is notoriously unreliable. ANALYZE improves most of it when it is badly off, but not for vector indexes.
      I've set the fix version to 13.1 as it's where the problem becomes evident, please feel free to adjust it as needed.

      --source include/have_innodb.inc
      --source include/have_sequence.inc
       
      create table t (
        pk int primary key,
        v vector(1) not null,
        vector(v)
      ) engine=InnoDB;
      insert into t select seq, vec_fromtext(concat('[',seq,']'))
        from seq_1_to_1000;
      select total_nodes, table_rows from information_schema.vector_indexes
        natural join information_schema.tables
        where table_name = 't';
       
      --source include/restart_mysqld.inc
       
      select total_nodes, table_rows from information_schema.vector_indexes
        natural join information_schema.tables
        where table_name = 't';
       
      analyze table t;
       
      select total_nodes, table_rows from information_schema.vector_indexes
        natural join information_schema.tables
        where table_name = 't';
       
      drop table t;
      

      PR-4955 7ab9408e1b8b8d6c84f12cf7d666b353591dc412

      select total_nodes, table_rows from information_schema.vector_indexes
      natural join information_schema.tables
      where table_name = 't';
      total_nodes     table_rows
      1000    1000
      # restart
      select total_nodes, table_rows from information_schema.vector_indexes
      natural join information_schema.tables
      where table_name = 't';
      total_nodes     table_rows
      31      21
      analyze table t;
      Table   Op      Msg_type        Msg_text
      test.t  analyze status  Engine-independent statistics collected
      test.t  analyze status  OK
      select total_nodes, table_rows from information_schema.vector_indexes
      natural join information_schema.tables
      where table_name = 't';
      total_nodes     table_rows
      31      1000
      

      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.