Skip to content

Execution plan using a vector index seek does not render with Actual Execution Plan #22146

@rgward

Description

@rgward

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

  1. Deploy an Azure SQL Database
  2. 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

  1. 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

  • Connection dialog (SQL Server | Azure browse/Fabric browse)
  • Query editor
  • Query results panel
  • Object Explorer
  • GitHub Copilot integration
  • Preview/Edit data
  • Table Designer
  • Schema Designer
  • Schema Compare
  • Local SQL Server Container provisioning
  • SQL database in Fabric provisioning
  • DACPAC/BACPAC export/import
  • SQL Database projects
  • Query Plan Visualizer
  • Other (please describe below)

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

  • I have searched existing issues and couldn't find a match
  • I want to work on this issue

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions