Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.8, 12.3, 12.3.3, 13.0.2
-
Linux/amd64
Description
INFORMATION_SCHEMA.TABLES.INDEX_LENGTH underreports the size of an InnoDB VECTOR index backed by a hidden graph table. This can make metadata-based storage accounting inaccurate.
How to repeat:
CREATE DATABASE vector_index_size_test; |
USE vector_index_size_test; |
|
|
CREATE TABLE vector_size ( |
id INT PRIMARY KEY, |
v VECTOR(4) NOT NULL, |
VECTOR INDEX vi(v) |
) ENGINE=InnoDB;
|
|
|
INSERT INTO vector_size |
SELECT seq, VEC_FromText(CONCAT('[', seq, ',', seq + 1, ',', seq + 2, ',', seq + 3, ']')) |
FROM seq_1_to_20000; |
|
|
ANALYZE TABLE vector_size; |
FLUSH TABLE vector_size; |
|
|
SELECT t.INDEX_LENGTH AS table_index_bytes, |
s.NAME AS hidden_graph_name, |
s.CLUST_INDEX_SIZE * @@innodb_page_size AS hidden_data_bytes, |
s.OTHER_INDEX_SIZE * @@innodb_page_size AS hidden_secondary_bytes, |
(s.CLUST_INDEX_SIZE + s.OTHER_INDEX_SIZE) * @@innodb_page_size AS vector_index_bytes, |
t.INDEX_LENGTH >= (s.CLUST_INDEX_SIZE + s.OTHER_INDEX_SIZE) * @@innodb_page_size AS invariant_holds |
FROM INFORMATION_SCHEMA.TABLES AS t |
JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS AS s |
ON s.NAME = CONCAT(t.TABLE_SCHEMA, '/', t.TABLE_NAME, '#i#01') |
WHERE t.TABLE_SCHEMA = DATABASE() |
AND t.TABLE_NAME = 'vector_size'; |
Actual result:
table_index_bytes: 16384
hidden_data_bytes: 16384
hidden_secondary_bytes: 32768
vector_index_bytes: 49152
invariant_holds: 0
TABLES.INDEX_LENGTH reports only 16,384 bytes while the hidden graph's clustered and secondary indexes occupy 49,152 bytes.
Expected result:
TABLES.INDEX_LENGTH should be at least (CLUST_INDEX_SIZE + OTHER_INDEX_SIZE) * innodb_page_size for the table's sole VECTOR index, so invariant_holds should be 1.
Attachments
Issue Links
- relates to
-
MDEV-35821 vector index sizes are not in information_schema.TABLES nor SHOW TABLE STATUS
-
- Closed
-
-
MDEV-40229 I_S.VECTOR_INDEXES: Unclear or inconsistent semantics of INDEX_SIZE
-
- Closed
-