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

I_S.VECTOR_INDEXES data inaccuracy for InnoDB tables is beyond approximate statistics

    XMLWordPrintable

Details

    • Q3/2026 Server Maintenance

    Description

      InnoDB statistics is always inaccurate, but for VECTOR_INDEXES some values are completely off. For example, in the test case below the data shows thousands of deleted rows right after INSERT, when nothing was ever deleted.
      Increasing innodb_stats_persistent_sample_pages does not seem to have any effect.

      --source include/have_sequence.inc
      --source include/have_innodb.inc
       
      CREATE TABLE t (
        id INT PRIMARY KEY,
        v VECTOR(2000) NOT NULL,
        VECTOR vi(v)
      ) ENGINE=InnoDB;
      INSERT INTO t SELECT seq,
        VEC_FromText(CONCAT('[', seq, ',', REPEAT('1,', 1998), '1]'))
        FROM seq_1_to_6000;
       
      ANALYZE TABLE t;
       
      query_vertical
      SELECT TOTAL_NODES, CACHED_NODES, DELETED_ROWS, INDEX_SIZE, MEMORY_SIZE
      FROM information_schema.vector_indexes;
       
      DROP TABLE t;
      

      b9d7dd0f991af35b059631f0f43b7bf390080d96

      CREATE TABLE t (
      id INT PRIMARY KEY,
      v VECTOR(2000) NOT NULL,
      VECTOR vi(v)
      ) ENGINE=InnoDB;
      INSERT INTO t SELECT seq,
      VEC_FromText(CONCAT('[', seq, ',', REPEAT('1,', 1998), '1]'))
      FROM seq_1_to_6000;
      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, CACHED_NODES, DELETED_ROWS, INDEX_SIZE, MEMORY_SIZE
      FROM information_schema.vector_indexes;
      TOTAL_NODES	6000
      CACHED_NODES	0
      DELETED_ROWS	2999
      INDEX_SIZE	16384
      MEMORY_SIZE	0
      

      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:

                Time Tracking

                  Estimated:
                  Original Estimate - 3h 22m
                  3h 22m
                  Remaining:
                  Remaining Estimate - 3h 22m
                  3h 22m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                  Git Integration

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