You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[!INCLUDE[ssCatViewPerm](../../includes/sscatviewperm-md.md)] For more information, see [Metadata Visibility Configuration](../security/metadata-visibility-configuration.md).
38
39
39
-
[!INCLUDE[ssCatViewPerm](../../includes/sscatviewperm-md.md)] For more information, see [Metadata Visibility Configuration](../../relational-databases/security/metadata-visibility-configuration.md).
40
-
41
-
## Examples
40
+
## Examples
42
41
43
42
The following example returns all indexes for the table `[dbo].[[wikipedia_articles_embeddings]` used in the [DiskANN sample](https://github.com/Azure-Samples/azure-sql-db-vector-search/tree/main/DiskANN/Wikipedia) available in the [https://github.com/Azure-Samples/azure-sql-db-vector-search](https://github.com/Azure-Samples/azure-sql-db-vector-search) GitHub sample repo.
44
-
43
+
45
44
```sql
46
-
select
47
-
vi.obj_id,
48
-
vi.index_id,
49
-
vi.index_type,
50
-
vi.dist_metric,
51
-
vi.build_parameters
52
-
from
53
-
sys.indexes i
54
-
inner join
55
-
sys.vector_indexesas vi onvi.obj_id=i.object_idandvi.index_id=i.index_id
This article contains frequently asked questions about vectors and embeddings in the SQL Database Engine.
25
+
24
26
> [!NOTE]
25
27
> Vector features are available in Azure SQL Managed Instance configured with the [Always-up-to-date](/azure/azure-sql/managed-instance/update-policy#always-up-to-date-update-policy) policy.
26
28
@@ -46,7 +48,7 @@ For more information about how to choose the right embedding model, see [Embeddi
46
48
47
49
## What about sparse vectors?
48
50
49
-
At this time, the **vector** data type in SQL Server is designed for dense vectors, which are arrays of floating-point numbers where most of the elements are non-zero. Sparse vectors, which contain a significant number of zero elements, aren't natively supported.
51
+
At this time, the **vector** data type in the SQL Database Engine is designed for dense vectors, which are arrays of floating-point numbers where most of the elements are non-zero. Sparse vectors, which contain a significant number of zero elements, aren't natively supported.
50
52
51
53
## What are some performance benchmarks for SQL vector search?
52
54
@@ -59,19 +61,19 @@ If you have multiple columns that you want to use for generating embeddings, you
59
61
- Create one embedding for each column, or
60
62
- Concatenate the values of multiple columns into a single string and then generate a single embedding for that concatenated string.
61
63
62
-
For more information about the two options and the related database design considerations, see [Efficiently and Elegantly Modeling Embeddings in Azure SQL and SQL Server](https://devblogs.microsoft.com/azure-sql/efficiently-and-elegantly-modeling-embeddings-in-azure-sql-and-sql-server/).
64
+
For more information about the two options and the related database design considerations, see [Efficiently and Elegantly Modeling Embeddings](https://devblogs.microsoft.com/azure-sql/efficiently-and-elegantly-modeling-embeddings-in-azure-sql-and-sql-server/).
63
65
64
66
## What about re-ranking?
65
67
66
-
Re-ranking is a technique used to improve the relevance of search results by re-evaluating the initial results based on additional criteria or models. In SQL Server, you can implement re-ranking by combining vector search with full-text (which provides BM25 ranking) or additional SQL queries or machine learning models to refine the results based on specific business logic or user preferences.
68
+
Re-ranking is a technique used to improve the relevance of search results by re-evaluating the initial results based on additional criteria or models. In the SQL Database Engine, you can implement re-ranking by combining vector search with full-text (which provides BM25 ranking) or additional SQL queries or machine learning models to refine the results based on specific business logic or user preferences.
67
69
68
-
For more information, review [Enhancing Search Capabilities in SQL Server and Azure SQL with Hybrid Search and RRF Re-Ranking](https://devblogs.microsoft.com/azure-sql/enhancing-search-capabilities-in-sql-server-and-azure-sql-with-hybrid-search-and-rrf-re-ranking/).
70
+
For more information, review [Enhancing Search Capabilities with Hybrid Search and RRF Re-Ranking](https://devblogs.microsoft.com/azure-sql/enhancing-search-capabilities-in-sql-server-and-azure-sql-with-hybrid-search-and-rrf-re-ranking/).
69
71
70
72
## When to use AI Search (now AI Foundry) vs using SQL for vectors search scenarios?
71
73
72
74
AI Search (now AI Foundry) is a specialized service designed for advanced search scenarios, including vector search, natural language processing, and AI-driven insights. It provides a comprehensive set of features for building intelligent search applications, such as built-in support for various AI models, advanced ranking algorithms, and integration with other AI services.
73
75
74
-
Azure SQL and SQL Server provide the ability to store any kind of data and run any kind of query: structured and unstructured, and to perform vector search on that data. It is a good choice for scenarios where you need to do search across all these data together, and you don't want to use a separate service for search that would complicate your architecture. Azure SQL and SQL Server offer critical enterprise security features to make sure data is always protected, such as row-level security (RLS), dynamic data masking (DDM), Always Encrypted, immutable ledger tables, and transparent data encryption (TDE).
76
+
The SQL Database Engine provides the ability to store any kind of data and run any kind of query: structured and unstructured, and to perform vector search on that data. It is a good choice for scenarios where you need to do search across all these data together, and you don't want to use a separate service for search that would complicate your architecture. The SQL Database Engine offers critical enterprise security features to make sure data is always protected, such as row-level security (RLS), dynamic data masking (DDM), Always Encrypted, immutable ledger tables, and transparent data encryption (TDE).
75
77
76
78
Here's an example of a single query that can be run in Azure SQL or SQL Server that combines vector, geospatial, structured and unstructured data all at once. The sample query retrieves the top 50 most relevant restaurants based on the description of the restaurant, the location of the restaurant, and the user's preferences, using vector search for the description and geospatial search for the location, filtering also by star numbers, number of reviews, category and so on:
The SQL Database Engine provides the ability to store any kind of data and run any kind of query: structured and unstructured, and to perform vector search on that data. It is a good choice for scenarios where you need to do search across all these data together, and you don't want to use a separate service for search that would complicate your architecture.
25
+
24
26
> [!NOTE]
25
-
> - Vector features are available in Azure SQL Managed Instance configured with the [Always-up-to-date](/azure/azure-sql/managed-instance/update-policy#always-up-to-date-update-policy) policy.
27
+
> - Vector support in preview and is subject to change. Make sure to read preview usage terms in [Service Level Agreements (SLA) for Online Services](https://www.microsoft.com/licensing/docs/view/Service-Level-Agreements-SLA-for-Online-Services).
28
+
29
+
Vector features are available in Azure SQL Managed Instance configured with the [Always-up-to-date](/azure/azure-sql/managed-instance/update-policy#always-up-to-date-update-policy) policy.
26
30
27
-
## Vectors
31
+
## Vectors
28
32
29
33
Vectors are ordered arrays of numbers (typically floats) that can represent information about some data. For example, an image can be represented as a vector of pixel values, or a string of text can be represented as a vector of ASCII values. The process to turn data into a vector is called vectorization. The **[vector](../../t-sql/data-types/vector-data-type.md)** data type in SQL Server is designed to store these arrays of numbers efficiently.
> This data type is in preview and is subject to change. Make sure to read preview usage terms in the [Service Level Agreements (SLA) for Online Services](https://www.microsoft.com/licensing/docs/view/Service-Level-Agreements-SLA-for-Online-Services) document.
31
-
32
-
Takes a vector as an input and returns the norm of the vector (which is a measure of its length or magnitude) in a given [norm type](https://mathworld.wolfram.com/VectorNorm.html).
30
+
Use `VECTOR_NORM` to take a vector as an input and return the norm of the vector (which is a measure of its length or magnitude) in a given [norm type](https://mathworld.wolfram.com/VectorNorm.html).
33
31
34
32
For example, if you want to calculate the Euclidean norm (which is the most common norm type), you can use:
35
33
36
34
```sql
37
35
SELECT VECTOR_NORM ( vector, 'norm2' )
38
36
FROM ...
39
37
```
40
-
41
-
## Syntax
42
-
38
+
39
+
> [!NOTE]
40
+
> This data type is in preview and is subject to change. Make sure to read preview usage terms in the [Service Level Agreements (SLA) for Online Services](https://www.microsoft.com/licensing/docs/view/Service-Level-Agreements-SLA-for-Online-Services) document.
41
+
42
+
`VECTOR_NORM` is available in Azure SQL Managed Instance configured with the [Always-up-to-date](/azure/azure-sql/managed-instance/update-policy#always-up-to-date-update-policy) update policy.
@@ -64,7 +67,7 @@ A string with the name of the norm type to use to calculate the norm of the give
64
67
65
68
The function returns a **float** value that represents the norm of the vector using the specified norm type.
66
69
67
-
An error is returned if *norm_type* isn't a valid norm type and if the vector is not of the [vector data type](../../t-sql/data-types/vector-data-type.md).
70
+
An error is returned if *norm_type* isn't a valid norm type and if the vector is not of the [vector data type](../data-types/vector-data-type.md).
> This data type is in preview and is subject to change. Make sure to read preview usage terms in the [Service Level Agreements (SLA) for Online Services](https://www.microsoft.com/licensing/docs/view/Service-Level-Agreements-SLA-for-Online-Services) document.
29
-
30
-
`VECTOR_NORMALIZE` takes a vector as an input and returns the normalized vector, which is a vector scaled to have a length of 1 in a given [norm type](https://mathworld.wolfram.com/VectorNorm.html).
28
+
Use `VECTOR_NORMALIZE` to take a vector as an input and return the normalized vector, which is a vector scaled to have a length of 1 in a given [norm type](https://mathworld.wolfram.com/VectorNorm.html).
31
29
32
30
This standardization is crucial in various artificial intelligence applications where vectors represent different forms of data, such as visual content, textual information, or audio signals. By normalizing vectors, we ensure uniformity in their scale, which is particularly useful for operations that rely on measuring vector distances or for grouping and distinguishing data points.
33
31
@@ -46,7 +44,8 @@ FROM ...
46
44
47
45
> [!NOTE]
48
46
> - This function is in preview and is subject to change. Make sure to read preview usage terms in [Service Level Agreements (SLA) for Online Services](https://www.microsoft.com/licensing/docs/view/Service-Level-Agreements-SLA-for-Online-Services).
49
-
> -`VECTOR_NORMALIZE` is available in Azure SQL Managed Instance configured with the [Always-up-to-date](/azure/azure-sql/managed-instance/update-policy#always-up-to-date-update-policy) update policy.
47
+
48
+
`VECTOR_NORMALIZE` is available in Azure SQL Managed Instance configured with the [Always-up-to-date](/azure/azure-sql/managed-instance/update-policy#always-up-to-date-update-policy) update policy.
50
49
51
50
## Syntax
52
51
@@ -76,7 +75,7 @@ The result is a vector with the same direction as the input vector but with a le
76
75
77
76
If the input is `NULL`, the returned result will also be `NULL`.
78
77
79
-
An error is returned if *norm_type* isn't a valid norm type and if the *vector* is not of the [vector](../../t-sql/data-types/vector-data-type.md) data type.
78
+
An error is returned if *norm_type* isn't a valid norm type and if the *vector* is not of the [vector](../data-types/vector-data-type.md) data type.
0 commit comments