Description
A visual query plan cannot be displayed for a query that contains a vector index seek. The visual plan does not appear. A resulting showplan XML is returned and if select it the following error is returned "There is an error in XML document (1, 6200). ---> Instance validation error: 'Vector Index Seek' is not a valid value for PhysicalOpType."
Steps to Reproduce
- Deploy an Azure SQL Database
- Run the following commands to create a table, fill in embeddings, and create a vector index
-- Latest-version vector indexes require >= 100 rows before index creation.
-- Use a uniquely-named table so we don't collide with demo objects.
IF OBJECT_ID(N'dbo.repro_vec_showplan', N'U') IS NOT NULL
DROP TABLE dbo.repro_vec_showplan;
GO
CREATE TABLE dbo.repro_vec_showplan
(
Id int NOT NULL PRIMARY KEY,
Label nvarchar(50) NOT NULL,
Embedding vector(4) NOT NULL -- tiny dimension for clarity
);
GO
-- 100 rows of mock embeddings (required minimum for latest vector index).
INSERT dbo.repro_vec_showplan (Id, Label, Embedding)
SELECT value,
CONCAT(N'row_', value),
CAST(CONCAT(
N'[',
CAST(value * 0.01 AS nvarchar(20)), N',',
CAST(value * 0.02 AS nvarchar(20)), N',',
CAST(value * 0.03 AS nvarchar(20)), N',',
CAST(value * 0.04 AS nvarchar(20)),
N']') AS vector(4))
FROM GENERATE_SERIES(1, 100);
GO
-- Build the vector index. The showplan has to describe this in XML
-- using its IndexKind enum value.
CREATE VECTOR INDEX ix_repro_vec_showplan_emb
ON dbo.repro_vec_showplan (Embedding)
WITH (METRIC = 'cosine', TYPE = 'diskann');
GO
- Select Actual Execution Plan from the query editor and run this query
DECLARE @q vector(4) = CAST('[0.95, 0.05, 0.0, 0.0]' AS vector(4));
SELECT TOP 3 WITH APPROXIMATE
v.Id, v.Label, r.distance
FROM VECTOR_SEARCH(
TABLE = dbo.repro_vec_showplan AS v,
COLUMN = Embedding,
SIMILAR_TO = @q,
METRIC = 'cosine') AS r
ORDER BY r.distance;
GO
Affected Area
If you selected "Other", please describe the affected area
No response
Environment Information
VS Code: 1.121.0
MSSQL extension (ms-mssql.mssql): 1.42.2
Windows 11
Confirmation
Description
A visual query plan cannot be displayed for a query that contains a vector index seek. The visual plan does not appear. A resulting showplan XML is returned and if select it the following error is returned "There is an error in XML document (1, 6200). ---> Instance validation error: 'Vector Index Seek' is not a valid value for PhysicalOpType."
Steps to Reproduce
-- Latest-version vector indexes require >= 100 rows before index creation.
-- Use a uniquely-named table so we don't collide with demo objects.
IF OBJECT_ID(N'dbo.repro_vec_showplan', N'U') IS NOT NULL
DROP TABLE dbo.repro_vec_showplan;
GO
CREATE TABLE dbo.repro_vec_showplan
(
Id int NOT NULL PRIMARY KEY,
Label nvarchar(50) NOT NULL,
Embedding vector(4) NOT NULL -- tiny dimension for clarity
);
GO
-- 100 rows of mock embeddings (required minimum for latest vector index).
INSERT dbo.repro_vec_showplan (Id, Label, Embedding)
SELECT value,
CONCAT(N'row_', value),
CAST(CONCAT(
N'[',
CAST(value * 0.01 AS nvarchar(20)), N',',
CAST(value * 0.02 AS nvarchar(20)), N',',
CAST(value * 0.03 AS nvarchar(20)), N',',
CAST(value * 0.04 AS nvarchar(20)),
N']') AS vector(4))
FROM GENERATE_SERIES(1, 100);
GO
-- Build the vector index. The showplan has to describe this in XML
-- using its IndexKind enum value.
CREATE VECTOR INDEX ix_repro_vec_showplan_emb
ON dbo.repro_vec_showplan (Embedding)
WITH (METRIC = 'cosine', TYPE = 'diskann');
GO
DECLARE @q vector(4) = CAST('[0.95, 0.05, 0.0, 0.0]' AS vector(4));
SELECT TOP 3 WITH APPROXIMATE
v.Id, v.Label, r.distance
FROM VECTOR_SEARCH(
TABLE = dbo.repro_vec_showplan AS v,
COLUMN = Embedding,
SIMILAR_TO = @q,
METRIC = 'cosine') AS r
ORDER BY r.distance;
GO
Affected Area
If you selected "Other", please describe the affected area
No response
Environment Information
VS Code: 1.121.0
MSSQL extension (ms-mssql.mssql): 1.42.2
Windows 11
Confirmation