Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.8, 12.3, 13.0, 13.1, 13.2
-
None
Description
--source include/have_partition.inc
|
--source include/have_innodb.inc
|
--let $v= query_get_value(SELECT COUNT(*) AS c FROM information_schema.GLOBAL_VARIABLES WHERE VARIABLE_NAME='MHNSW_MAX_CACHE_SIZE', c, 1)
|
if (!$v) |
{
|
--skip Needs the VECTOR data type |
}
|
 |
CREATE TABLE t1 (a INT, v VECTOR(2) NOT NULL) ENGINE=InnoDB PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (20)); |
INSERT INTO t1 VALUES (1, VEC_FromText('[100,100]')),(2, VEC_FromText('[200,200]')),(3, VEC_FromText('[300,300]')); |
CREATE TABLE t2 (a INT, v VECTOR(2) NOT NULL, VECTOR INDEX (v)) ENGINE=InnoDB; |
INSERT INTO t2 VALUES (5, VEC_FromText('[1,2]')),(6, VEC_FromText('[3,4]')); |
# t1 has no VECTOR INDEX and t2 has one, so the definitions differ |
--error 0,ER_TABLES_DIFFERENT_METADATA
|
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; |
if (!$mysql_errno) |
{
|
SELECT COUNT(*) INTO @c FROM (SELECT a FROM t2 ORDER BY VEC_DISTANCE_EUCLIDEAN(v, VEC_FromText('[1,2]')) LIMIT 3) AS d; |
--let $c= query_get_value(SELECT @c AS c, c, 1) |
if ($c != 3) |
{
|
--die The vector search on t2 finds $c of its 3 rows after EXCHANGE PARTITION, which ignored its VECTOR INDEX |
}
|
}
|
DROP TABLE t1, t2; |
Leads to:
|
CS 13.1.0 da18481158c81ca94689702073c3e04aad85a6a3 (Debug, Clang 22.1.8-20260622) Build 18/08/2026 |
mysqltest: At line 22: The vector search on t2 finds 2 of its 3 rows after EXCHANGE PARTITION, which ignored its VECTOR INDEX
|
Partitioning changes the query result. With IGNORE INDEX (v), the same search finds the 3 rows. After DROP INDEX and ADD VECTOR INDEX on t2, the search also finds the 3 rows. With a plain INDEX (a) on t2 in place of the VECTOR INDEX, the EXCHANGE PARTITION gives ER_TABLES_DIFFERENT_METADATA. Optimized builds give the same result.
From the code it seems that mysql_compare_tables() in sql/sql_table.cc compares only the first table->s->keys keys. keys does not count high level indexes such as a VECTOR INDEX, total_keys does (sql/table.h). So compare_table_with_partition() in sql/sql_partition_admin.cc does not see the VECTOR INDEX on t2.
Attachments
Issue Links
- relates to
-
MDEV-35315 vector indexes in partitioned tables
-
- Open
-