QuestionQ86

VerifiedSecure, optimize, and deploy database solutions

You have a Microsoft SQL Server 2025 database containing a table named products. products has two columns named description and embedding. The embedding value is generated from description.

You have an application named App1. App1 includes a feature that uses the following query:

VECTOR_DISTANCE(‘cosine’, @query_vector, embedding)

Users report that this feature is slow during peak usage periods.

You determine that semantic-search latency rises and CPU utilization spikes during peak usage periods.

You need to reduce the latency and CPU utilization associated with the App1 feature.

What should you do?

Explanation

VECTOR_DISTANCE calculates exact vector distances and does not use a vector index, which can require comparisons across all embeddings. A vector index combined with VECTOR_SEARCH enables approximate nearest-neighbor search, reducing the work required for semantic search. The vector index must match the search metric, so the cosine metric should be used for both the index and VECTOR_SEARCH.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!