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

Query from I_S.VECTOR_INDEXES does not retrieve all data unless the table is open

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      If the table is not already open, a query from VECTOR_INDEXES does not fetch all data it is supposed to return (does not open the vector index "table"?), including some data which shouldn't depend on the session, like total_nodes or index_size.

      The test case below uses FLUSH TABLES, the same can be achieved with e.g. server restart or ALTER TABLE.

      create table t (a vector(1) not null, vector(a)) engine=MyISAM;
      insert into t values (0x31313131),(0x32323232),(0x33333333);
      delete from t where a = 0x31313131;
       
      --echo #
      --echo # After DML: VECTOR_INDEXES is populated
      --echo # 
      query_vertical
      select * from information_schema.vector_indexes 
      where table_schema = 'test' and table_name = 't';
       
      flush tables;
      --echo # 
      --echo # After FLUSH TABLES: index_size, total_nodes, deleted_rows
      --echo #                     are all reset
      --echo # 
      query_vertical
      select * from information_schema.vector_indexes 
      where table_schema = 'test' and table_name = 't';
       
      --echo # 
      --echo # A query from INFORMATION_SCHEMA.TABLES shows index_length
      --echo # 
       
      query_vertical
      select * from information_schema.tables 
      where table_schema = 'test' and table_name = 't';
       
      --echo # 
      --echo # ... and the data in VECTOR_INDEXES is now present
      --echo # 
       
      query_vertical
      select * from information_schema.vector_indexes 
      where table_schema = 'test' and table_name = 't';
       
      drop table t;
      

      5dae70e86321916d219c465b19991c5261c3f26a

      create table t (a vector(1) not null, vector(a)) engine=MyISAM;
      insert into t values (0x31313131),(0x32323232),(0x33333333);
      delete from t where a = 0x31313131;
      #
      # After DML: VECTOR_INDEXES is populated
      # 
      select * from information_schema.vector_indexes 
      where table_schema = 'test' and table_name = 't';
      TABLE_SCHEMA	test
      TABLE_NAME	t
      INDEX_NAME	a
      VECTOR_DIMENSIONS	1
      INDEX_SIZE	152
      TOTAL_NODES	3
      CACHED_NODES	3
      DELETED_ROWS	1
      SUBDIST_ENABLED	NO
      MEMORY_SIZE	4194176
      CACHE_OVERFLOWS	0
      flush tables;
      # 
      # After FLUSH TABLES: index_size, total_nodes, deleted_rows
      #                     are all reset
      # 
      select * from information_schema.vector_indexes 
      where table_schema = 'test' and table_name = 't';
      TABLE_SCHEMA	test
      TABLE_NAME	t
      INDEX_NAME	a
      VECTOR_DIMENSIONS	1
      INDEX_SIZE	NULL
      TOTAL_NODES	0
      CACHED_NODES	0
      DELETED_ROWS	NULL
      SUBDIST_ENABLED	NO
      MEMORY_SIZE	0
      CACHE_OVERFLOWS	NULL
      # 
      # A query from INFORMATION_SCHEMA.TABLES shows index_length
      # 
      select * from information_schema.tables 
      where table_schema = 'test' and table_name = 't';
      TABLE_CATALOG	def
      TABLE_SCHEMA	test
      TABLE_NAME	t
      TABLE_TYPE	BASE TABLE
      ENGINE	MyISAM
      VERSION	10
      ROW_FORMAT	Dynamic
      TABLE_ROWS	2
      AVG_ROW_LENGTH	20
      DATA_LENGTH	60
      MAX_DATA_LENGTH	281474976710655
      INDEX_LENGTH	1176
      DATA_FREE	20
      AUTO_INCREMENT	NULL
      CREATE_TIME	2026-07-01 16:32:12
      UPDATE_TIME	2026-07-01 16:32:12
      CHECK_TIME	NULL
      TABLE_COLLATION	utf8mb4_uca1400_ai_ci
      CHECKSUM	NULL
      CREATE_OPTIONS	
      TABLE_COMMENT	
      MAX_INDEX_LENGTH	17179868160
      TEMPORARY	N
      # 
      # ... and the data for VECTOR_INDEXES is now present
      # 
      select * from information_schema.vector_indexes 
      where table_schema = 'test' and table_name = 't';
      TABLE_SCHEMA	test
      TABLE_NAME	t
      INDEX_NAME	a
      VECTOR_DIMENSIONS	1
      INDEX_SIZE	152
      TOTAL_NODES	3
      CACHED_NODES	0
      DELETED_ROWS	1
      SUBDIST_ENABLED	NO
      MEMORY_SIZE	0
      CACHE_OVERFLOWS	NULL
      

      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:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 1h
                  1h

                  Git Integration

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