Category: AI

Build serverless APIs, including implementing triggers and bindings (AI-200 Exam Prep)

This post is a part of the AI-200: Developing AI Cloud Solutions on Azure  Exam Prep Hub.
This topic falls under these sections:
Connect to and consume Azure services (20–25%)
   --> Develop and implement Azure Functions
      --> Build serverless APIs, including implementing triggers and bindings


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Overview

Azure Functions is a serverless compute service that allows developers to execute code in response to events without managing the underlying servers. For AI-enabled applications, Azure Functions can provide lightweight, scalable APIs and backend processing components that connect AI workloads to databases, messaging services, storage, and other Azure services.

For the AI-200 exam, an important area is understanding how to build serverless APIs using Azure Functions, particularly how triggers and bindings work together.

The key concepts include:

  • HTTP triggers
  • HTTP output bindings
  • Function routes
  • Authorization levels
  • Input bindings
  • Output bindings
  • Binding expressions
  • Multiple bindings
  • Trigger versus binding
  • Stateless serverless API design
  • Connecting Functions to other Azure services
  • Appropriate use of HTTP-triggered Functions

1. What Is Azure Functions?

Azure Functions is an event-driven serverless compute platform.

Instead of provisioning and maintaining virtual machines or application servers, you deploy individual functions that execute when an event occurs.

A function can be triggered by events such as:

  • HTTP requests
  • Azure Storage queue messages
  • Blob changes
  • Service Bus messages
  • Event Grid events
  • Event Hubs events
  • Timer schedules

For example, an AI application might expose an HTTP endpoint:

POST /api/summarize

The request could contain a document that needs to be summarized.

The HTTP-triggered Function could:

  1. Receive the request.
  2. Validate the input.
  3. Call an Azure AI service.
  4. Store the result in a database.
  5. Return the generated summary.

This allows the application to implement an API without maintaining a dedicated web server.


2. What Is a Trigger?

A trigger defines how a function is invoked.

Every Azure Function must have exactly one trigger.

For example:

HTTP request
|
v
HTTP trigger
|
v
Azure Function

The trigger provides the initial event or data that causes the function to execute.

Common triggers include:

TriggerFunction executes when…
HTTPAn HTTP request is received
TimerA scheduled time is reached
BlobA blob-related event occurs
QueueA queue message is available
Service BusA Service Bus message is available
Event GridAn Event Grid event is received
Event HubsEvents arrive in an Event Hub

For serverless APIs, the HTTP trigger is particularly important.


3. What Is an HTTP Trigger?

An HTTP trigger allows an Azure Function to execute when an HTTP request is received.

This makes HTTP-triggered Functions particularly useful for building:

  • REST APIs
  • Webhooks
  • Backend endpoints
  • AI inference APIs
  • Data-processing APIs
  • Lightweight microservices

For example:

Client
|
| POST /api/analyze
v
Azure Function
|
+----> Azure AI service
|
+----> Database
|
v
HTTP response

The HTTP trigger can respond to specific HTTP methods such as:

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE

The supported methods are configured as part of the HTTP trigger.


4. HTTP Trigger Versus HTTP Output Binding

One of the most important concepts for the exam is distinguishing the trigger from the output binding.

The HTTP trigger receives the request:

HTTP request
|
v
HTTP trigger

The HTTP output sends the response:

Function
|
v
HTTP output
|
v
HTTP response

Therefore:

HTTP trigger = how the function is invoked

HTTP output = how the function sends an HTTP response

In most Azure Functions programming models, the function’s return value can be used to produce the HTTP response.


5. HTTP Routes

An HTTP-triggered Function has a URL endpoint.

By default, the route generally follows this pattern:

https://<APP_NAME>.azurewebsites.net/api/<FUNCTION_NAME>

For example:

https://my-ai-api.azurewebsites.net/api/analyze

You can customize the route.

For example, an API might use:

/api/products/{id}

A request such as:

GET /api/products/123

can cause the Function to receive:

id = 123

Route parameters are particularly useful when designing REST-style APIs.


6. HTTP Methods

An API endpoint should normally expose only the HTTP methods it actually needs.

For example:

GET /api/products/{id}
POST /api/products
PUT /api/products/{id}
DELETE /api/products/{id}

A Function can be configured to respond to specific methods.

This allows a single Function endpoint to implement appropriate REST operations.

For example:

GET /api/orders/123

could retrieve an order, while:

POST /api/orders

could create an order.

Exam tip: Don’t confuse the HTTP method with the trigger. The HTTP trigger causes the Function to execute; the configured HTTP methods determine which types of requests the endpoint accepts.


7. Authorization Levels

HTTP-triggered Functions can use authorization levels to control who can invoke the function.

Common authorization levels include:

Anonymous

No Function key is required.

Useful for:

  • Public endpoints
  • Public webhooks
  • APIs where authentication is handled elsewhere

However, anonymous does not mean that the endpoint should necessarily be considered secure. If sensitive operations are exposed, authentication and authorization should be implemented appropriately.

Function

A Function key is required.

This provides a simple mechanism for restricting invocation of the Function.

Admin

An administrative key is required.

This provides a higher level of access and should be used carefully.

Exam consideration: If a question asks for an HTTP endpoint that should require a Function key, Function authorization is the relevant setting.


8. What Are Bindings?

Bindings provide a declarative way for Azure Functions to connect to other services.

There are two primary types:

  • Input bindings
  • Output bindings

Bindings allow developers to avoid writing all of the connection and resource-management code themselves.

For example, instead of manually creating an Azure Storage client, authenticating to Storage, and retrieving a blob, a Function can use a blob input binding.

Conceptually:

Function
|
+---- Input binding ----> Azure Storage
|
+---- Output binding ---> Database

Bindings are optional.

A Function can have:

  • A trigger only
  • A trigger + input binding
  • A trigger + output binding
  • A trigger + multiple input/output bindings

9. Trigger Versus Input Binding

A trigger and an input binding are related but serve different purposes.

Trigger

Determines when the function executes.

Input binding

Provides additional data to the function.

For example:

HTTP request
|
v
HTTP trigger
|
v
Function
|
+---- Blob input binding
| |
| v
| Blob data

The HTTP request causes the Function to execute.

The blob input binding provides additional data.


10. Output Bindings

An output binding allows a Function to write data to another service.

For example, an HTTP Function could receive a request and write the result to Azure Storage.

HTTP request
|
v
Function
|
+----> Storage output binding

Another example:

HTTP request
|
v
AI processing Function
|
+----> Cosmos DB
|
+----> HTTP response

Output bindings can simplify integration with supported Azure services.


11. Multiple Bindings

A Function can use multiple bindings.

For example, an AI API might:

  1. Receive an HTTP request.
  2. Read customer information from Cosmos DB.
  3. Call an AI service.
  4. Write the result to Blob Storage.
  5. Return an HTTP response.

Conceptually:

                   +--> Cosmos DB input
                   |
HTTP request ---> Function ---> Blob Storage output
                   |
                   +--> HTTP response

The Function still has only one trigger, but it can have multiple additional bindings.


12. Binding Expressions

Binding expressions allow information from one binding to be used dynamically by another binding.

For example, suppose a queue message contains:

customer123

A binding expression could use that value to determine which resource should be accessed.

Conceptually:

Queue message
|
| customer123
v
Queue trigger
|
v
Binding expression
|
v
Customer-specific resource

This can reduce hardcoded configuration and make Functions more flexible.

Binding expressions commonly use curly-brace syntax such as:

{parameter}

13. Application Settings and Connection Information

Bindings commonly reference configuration values through application settings.

For example:

MyStorageConnection

could identify an application setting containing the connection information required by a storage binding.

This is preferable to hardcoding connection strings directly into source code.

For example, avoid:

connectionString = "DefaultEndpointsProtocol=..."

Instead, reference configuration:

connection = "MyStorageConnection"

The actual configuration can then be supplied through the Function App’s settings.

For production workloads, secrets should be managed securely, commonly using Azure Key Vault and managed identities where appropriate.


14. Building a Serverless API

A typical serverless API using Azure Functions can follow this architecture:

                  Client
                    |
                    | HTTPS
                    v
              HTTP Trigger
                    |
                    v
              Azure Function
             /      |       \
            /       |        \
           v        v         v
      Cosmos DB   Azure AI   Service Bus
         |          |           |
         +----------+-----------+
                    |
                    v
              HTTP Response

The Function acts as the lightweight API layer.

This architecture is particularly useful for AI applications because the Function can coordinate several backend services without requiring a traditional application server.


15. Example: AI Inference API

Consider an AI application that exposes:

POST /api/analyze

The request contains:

{
"text": "Customer feedback..."
}

The Function could:

  1. Receive the HTTP request.
  2. Parse the JSON.
  3. Validate the input.
  4. Send the text to an AI service.
  5. Store the result.
  6. Return JSON to the client.

The response might look like:

{
"sentiment": "positive",
"confidence": 0.94
}

The Function therefore acts as an API façade around the AI processing workflow.


16. Choosing Between HTTP Triggers and Other Triggers

The trigger should match how the workload is initiated.

Use an HTTP trigger when:

  • A client needs to call an API.
  • A web application needs an endpoint.
  • A webhook needs to invoke the Function.
  • An application needs synchronous request/response behavior.

Use a queue or messaging trigger when:

  • Work should be processed asynchronously.
  • Requests may arrive faster than they can be processed.
  • You need decoupling between components.
  • Long-running processing should not block an HTTP request.

For example:

HTTP API
|
v
Service Bus
|
v
Function
|
v
AI processing

may be preferable to:

HTTP API
|
v
AI processing
|
v
HTTP response

when AI processing could take significant time.


17. Synchronous Versus Asynchronous APIs

This distinction is important when designing serverless AI applications.

Synchronous

The client waits for the Function to complete.

Client
|
| Request
v
Function
|
| Process
v
Client receives response

This works well when processing is relatively quick.

Asynchronous

The API accepts the request and places work into a messaging system.

Client
|
v
HTTP Function
|
v
Service Bus
|
v
Processing Function
|
v
AI workload

The client doesn’t have to wait for the complete operation.

This architecture can improve resilience and scalability.


18. HTTP Function Response Codes

A well-designed API should return appropriate HTTP status codes.

Common examples include:

StatusMeaningExample
200OKSuccessful GET
201CreatedResource created
202AcceptedAsynchronous processing accepted
204No ContentSuccessful request with no response body
400Bad RequestInvalid input
401UnauthorizedAuthentication required
403ForbiddenAccess denied
404Not FoundResource doesn’t exist
409ConflictResource conflict
500Internal Server ErrorUnexpected server failure

For example, if an API accepts an AI processing request and queues it for asynchronous processing, a 202 Accepted response may be appropriate.


19. Error Handling

Serverless APIs should explicitly handle expected errors.

For example:

Request
|
v
Validate input
|
+---- Invalid ---> 400 Bad Request
|
v
Process request
|
+---- Resource missing ---> 404
|
+---- Unexpected failure -> 500
|
v
200 OK

Don’t expose sensitive internal information in error responses.

For example, avoid returning:

SQL connection string:
Server=...
Password=...

or detailed internal stack traces to clients.


20. Connection Management

An important practical consideration when developing HTTP-triggered Azure Functions is connection management.

Creating a new HTTP client or network connection for every Function invocation can lead to connection exhaustion and degraded performance.

Applications should use appropriate connection reuse patterns rather than repeatedly creating unmanaged HTTP clients.

This becomes particularly important for Functions that call:

  • Azure AI services
  • REST APIs
  • Databases
  • Storage
  • Other backend services

21. Serverless API Design Best Practices

Keep Functions focused

A Function should ideally have a clear responsibility.

Avoid creating one enormous Function that:

  • Validates requests
  • Performs database operations
  • Calls multiple AI models
  • Sends emails
  • Processes files
  • Publishes events
  • Performs unrelated business logic

Smaller, focused Functions are generally easier to test and maintain.

Use configuration instead of hardcoding

Store environment-specific configuration outside application code.

Protect sensitive APIs

Use appropriate authentication and authorization.

Validate requests

Don’t assume that incoming JSON is valid.

Return appropriate status codes

Use HTTP semantics consistently.

Design for retries

Backend services may retry operations. Functions should avoid unintended duplicate side effects.

Avoid unnecessary synchronous processing

If an operation can take a long time, consider an asynchronous architecture using messaging.

Reuse connections

Avoid connection exhaustion caused by creating network clients unnecessarily.


22. Important AI-200 Exam Distinctions

The following distinctions are especially important to remember.

ConceptWhat it does
TriggerCauses the Function to execute
HTTP triggerExecutes the Function when an HTTP request arrives
Input bindingProvides additional data to the Function
Output bindingWrites Function output to another resource
HTTP outputSends an HTTP response
RouteDefines the HTTP endpoint pattern
Authorization levelControls Function-level invocation authorization
Binding expressionDynamically resolves binding values
Application settingStores configuration used by the application/bindings

A particularly important exam rule is:

A Function has exactly one trigger, but it can have multiple input and output bindings.


23. Key Takeaways

For the AI-200 exam, remember these points:

  1. Azure Functions provides serverless compute.
  2. A trigger determines when a Function runs.
  3. Every Function has exactly one trigger.
  4. HTTP triggers are used to create serverless APIs and receive webhooks.
  5. HTTP output provides the response to an HTTP-triggered request.
  6. Input bindings provide additional data to a Function.
  7. Output bindings allow a Function to write to supported services.
  8. A Function can have multiple input and output bindings.
  9. Binding expressions allow dynamic values to flow between bindings.
  10. Application settings should be used for configuration rather than hardcoding secrets.
  11. HTTP methods and routes define how an HTTP API endpoint behaves.
  12. Asynchronous workloads can use messaging services rather than keeping HTTP requests open.
  13. Appropriate HTTP status codes should communicate success and failure conditions.
  14. Connection reuse is important for high-throughput HTTP Functions.
  15. For production applications, authentication, authorization, secure configuration, validation, and error handling are essential.

Practice Exam Questions

Question 1

A developer is building a serverless API that should execute whenever a client sends an HTTP POST request. Which Azure Functions feature should the developer use to initiate the Function?

A. HTTP trigger
B. HTTP output binding
C. Queue output binding
D. Timer trigger

Correct Answer: A

Explanation: An HTTP trigger causes an Azure Function to execute when an HTTP request is received. An HTTP output binding is used to produce the HTTP response, while a queue output binding sends data to a queue. A timer trigger executes according to a schedule.


Question 2

A Function receives an HTTP request and needs to write the resulting document to Azure Blob Storage without explicitly creating and managing a Blob Storage client in application code. What should the developer use?

A. HTTP trigger
B. Blob Storage output binding
C. Timer trigger
D. HTTP route parameter

Correct Answer: B

Explanation: An output binding provides a declarative way for a Function to write data to another supported Azure service. A Blob Storage output binding can write the Function’s output to a blob without requiring the developer to implement all of the storage interaction manually.


Question 3

A Function needs to retrieve additional data from Azure Storage after being invoked by an HTTP request. Which configuration best satisfies this requirement?

A. Configure two HTTP triggers.
B. Configure a second HTTP output binding.
C. Configure an HTTP trigger and an input binding.
D. Configure two Function authorization keys.

Correct Answer: C

Explanation: The HTTP trigger determines when the Function runs, while an input binding can provide additional data to the Function. A Function must have exactly one trigger, but it can have additional input bindings.


Question 4

An HTTP-triggered Function should only respond to requests using the POST method. What should the developer configure?

A. A storage input binding
B. A timer schedule
C. A custom output binding
D. The HTTP trigger’s allowed HTTP methods

Correct Answer: D

Explanation: The HTTP trigger can be configured with the HTTP methods to which it responds. Restricting the endpoint to POST prevents other HTTP methods from invoking that endpoint.


Question 5

A developer needs an HTTP Function endpoint with the following URL pattern:

/api/orders/12345

where 12345 represents an order identifier. What Azure Functions feature should be used to define the 12345 portion dynamically?

A. Route parameter
B. Output binding
C. Timer expression
D. Function key

Correct Answer: A

Explanation: HTTP route parameters allow portions of the URL to be captured and passed to the Function. A route such as /api/orders/{id} can capture 12345 as the id parameter.


Question 6

An Azure Function needs to receive an HTTP request, retrieve information from a database, write a result to storage, and return an HTTP response. How should the Function be configured?

A. Four triggers
B. One HTTP trigger with appropriate input/output bindings
C. One database trigger and three HTTP triggers
D. Four separate timer triggers

Correct Answer: B

Explanation: A Function has exactly one trigger. In this scenario, the HTTP request should be the trigger, while database and storage interactions can be implemented using appropriate bindings. The HTTP response is also produced by the HTTP output mechanism.


Question 7

A developer wants to prevent an HTTP-triggered Function from being publicly invokable without a Function key. Which authorization level should be used?

A. Anonymous
B. Public
C. Function
D. None

Correct Answer: C

Explanation: The Function authorization level requires a Function key when invoking the HTTP endpoint. Anonymous does not require a Function key. Authentication and authorization requirements should still be evaluated in the context of the overall application architecture.


Question 8

An AI API accepts a request and places the work into a queue for processing by another Function. The API should immediately tell the client that the request has been accepted for processing rather than waiting for the AI operation to finish. Which HTTP status code is most appropriate?

A. 404
B. 500
C. 201
D. 202

Correct Answer: D

Explanation: 202 Accepted is appropriate when a request has been accepted for processing but the processing has not completed. This pattern is useful for asynchronous AI workloads where the client shouldn’t have to maintain an open HTTP request while the backend performs potentially lengthy processing.


Question 9

A Function receives a queue message and uses information from that message to determine which blob should be accessed through another binding. Which Azure Functions feature can dynamically pass values between bindings?

A. Binding expressions
B. Authorization levels
C. HTTP methods
D. Function keys

Correct Answer: A

Explanation: Binding expressions allow values from trigger metadata, binding data, and other supported sources to be incorporated dynamically into binding configuration. This allows Functions to avoid hardcoding resource names and paths.


Question 10

An HTTP-triggered Function calls an external AI service. Under heavy load, the Function begins experiencing connection exhaustion because a new HTTP client is created for every invocation. What is the best approach?

A. Increase the HTTP response timeout indefinitely.
B. Disable the HTTP trigger.
C. Use an appropriate connection-reuse pattern rather than repeatedly creating HTTP clients.
D. Add another HTTP trigger to the same Function.

Correct Answer: C

Explanation: Repeatedly creating and disposing HTTP clients can contribute to connection exhaustion and poor performance. HTTP clients and connections should be managed using an appropriate reuse pattern for the runtime and language being used. Adding triggers or changing the response timeout does not address the underlying connection-management problem.


Final Exam Review

If you remember only a handful of concepts for this AI-200 topic, make them these:

Trigger = starts the Function.

Binding = connects the Function to another resource.

Input binding = brings data into the Function.

Output binding = sends data from the Function to another resource.

HTTP trigger = serverless API entry point.

HTTP output = response to the API caller.

One Function = exactly one trigger, potentially multiple bindings.

And for scenario questions, focus on why the Function is being invoked and what resources it needs to interact with. Those two questions usually reveal whether the correct answer involves a trigger, an input binding, an output binding, or an HTTP configuration.


Go to the AI-200 Exam Prep Hub main page

Implement event-driven workflows by using Azure Event Grid, including filters, custom events, and retries (AI-200 Exam Prep)

This post is a part of the AI-200: Developing AI Cloud Solutions on Azure  Exam Prep Hub.
This topic falls under these sections:
Connect to and consume Azure services (20–25%)
   --> Develop event- and message-based AI solutions
      --> Implement event-driven workflows by using Azure Event Grid, including filters, custom events, and retries


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Overview

Modern AI applications frequently need to react to events rather than continuously poll systems for changes. For example:

  • A document is uploaded and needs to be processed.
  • A new customer record is created and should trigger enrichment.
  • An AI model finishes processing a request.
  • A database record changes and downstream systems need to respond.
  • A custom application event needs to trigger a serverless workflow.

Azure Event Grid is an event-routing service designed to connect event producers with event handlers. It can receive events from Azure services, custom applications, and partner sources and route matching events to subscribers.

For the AI-200 exam, you should understand how to:

  1. Design event-driven workflows with Event Grid.
  2. Create and use custom events and custom topics.
  3. Configure event subscriptions.
  4. Filter events.
  5. Understand Event Grid delivery and retry behavior.
  6. Configure retry policies and dead-lettering.
  7. Design consumers to tolerate duplicate or out-of-order events.

Event Grid is particularly useful when an application needs to react to something that has happened rather than explicitly requesting something to happen.


1. What Is Azure Event Grid?

Azure Event Grid is a managed event-routing service.

At a high level, the architecture looks like this:

Event source → Event Grid → Event subscription → Event handler

For example:

Blob Storage → Event Grid → Azure Function

A file upload can generate an event. Event Grid receives that event and routes it to an Azure Function, which processes the file.

Another example might be:

Application → Custom Event Grid Topic → Event Grid Subscription → AI Processing Service

The application publishes an event such as:

DocumentUploaded

Event Grid determines which subscriptions are interested in the event and delivers it to the appropriate handlers.

Event Grid supports system events from Azure services, custom application events, and partner events. It also provides filtering so subscribers receive only the events they need.


2. Event-Driven Architecture

An event-driven architecture separates the component that produces an event from the components that consume the event.

Consider an AI document-processing application.

A user uploads a document:

User
|
v
Blob Storage
|
| BlobCreated event
v
Event Grid
|
+----> Document Processing Function
|
+----> Audit Function
|
+----> Notification Service

The Blob Storage service doesn’t need to know how each consumer processes the event.

This provides several advantages:

  • Loose coupling
  • Independent scaling
  • Easier integration
  • Asynchronous processing
  • Multiple consumers
  • Reduced polling
  • Easier addition of new workflows

This is especially valuable for AI workloads because AI processing can be computationally expensive or time-consuming.

Instead of having an application constantly check whether something changed, an event can initiate processing only when necessary.


3. Important Event Grid Concepts

Several Event Grid terms are important for the AI-200 exam.

Event

An event describes something that happened.

Examples include:

ImageUploaded
DocumentCreated
OrderCompleted
ModelTrainingCompleted
CustomerCreated

An event generally contains information about the occurrence rather than instructions for what the receiver must do.

For example:

{
"eventType": "DocumentUploaded",
"subject": "/documents/invoice-123.pdf",
"data": {
"documentType": "invoice",
"customerId": "C1001"
}
}

Event Source

The event source is the system that generates the event.

Examples include:

  • Azure Storage
  • Azure resources
  • Custom applications
  • Partner services

Topic

A topic provides an endpoint through which events can be published.

For custom applications, you can create a custom topic and publish application-specific events to it.

For example:

OrderEvents

could receive:

OrderCreated
OrderUpdated
OrderCancelled
OrderCompleted

A custom topic allows an application to publish its own events without having to use an Azure service’s built-in event source.


Event Subscription

An event subscription tells Event Grid:

“Send matching events to this destination.”

A subscription connects an event source or topic to an event handler.

A subscription can define:

  • Destination
  • Event type filters
  • Subject filters
  • Advanced filters
  • Retry behavior
  • Dead-letter configuration

For example:

Custom Topic
|
+---- Subscription A → Azure Function
|
+---- Subscription B → Webhook
|
+---- Subscription C → Service Bus

Each subscription can independently determine which events it wants.


4. Event Handlers

The event handler is the destination that processes the event.

Depending on the Event Grid scenario, event handlers can include services such as:

  • Azure Functions
  • Azure Logic Apps
  • Webhooks
  • Azure Service Bus
  • Azure Event Hubs
  • Other supported Azure destinations

For AI applications, Azure Functions are particularly useful for lightweight event processing.

For example:

BlobCreated
|
v
Event Grid
|
v
Azure Function
|
+---- Extract text
+---- Generate embedding
+---- Store metadata
+---- Update search index

5. Event Grid vs. Message Queues

A common exam distinction is between events and messages/commands.

Event Grid is primarily an event-routing service.

It is appropriate when you want to communicate:

“Something happened.”

For example:

DocumentUploaded

A messaging service such as Azure Service Bus is more appropriate when you need durable message processing, commands, queues, transactions, sessions, or more sophisticated competing-consumer patterns.

For example:

ProcessThisDocument

is more command-like.

A useful rule is:

RequirementCommon choice
React to an eventEvent Grid
Route events to multiple consumersEvent Grid
Serverless event triggeringEvent Grid
Durable command/message processingService Bus
Queue-based workload processingService Bus
Pub/sub event routingEvent Grid

The services can also be combined.

For example:

Blob Storage
|
v
Event Grid
|
v
Service Bus Queue
|
v
AI Worker

Event Grid detects the event, while Service Bus provides durable message-processing capabilities.


6. Custom Events

A custom event is an event generated by your own application rather than an Azure service.

For example, an AI application might generate:

DocumentClassificationCompleted

with data such as:

{
"eventType": "DocumentClassificationCompleted",
"subject": "/documents/12345",
"data": {
"documentId": "12345",
"classification": "Invoice",
"confidence": 0.97
}
}

The application publishes the event to a custom Event Grid topic.

Other applications can subscribe to that topic.

For example:

AI Processing Application
|
| DocumentClassificationCompleted
v
Event Grid Topic
|
+------> Billing System
|
+------> Audit System
|
+------> Notification System

This provides a loosely coupled architecture.

The AI processing application doesn’t need to know which systems are consuming the event.


7. Custom Topics

A custom topic provides a user-defined Event Grid endpoint for publishing application events.

For example:

CustomerEvents

The application publishes events to the topic, and subscribers consume matching events.

A custom topic is appropriate when:

  • Your application generates its own events.
  • You need an application-specific event endpoint.
  • You want multiple applications to subscribe to your events.
  • You want Event Grid to perform routing and filtering.

The topic can support Event Grid or CloudEvents schemas depending on the configuration. Event Grid supports multiple event schemas, including Event Grid schema and CloudEvents schema.


8. Event Types

Event types identify what happened.

For example:

DocumentCreated
DocumentDeleted
DocumentProcessed
DocumentFailed

A single topic can publish multiple event types.

A subscriber may only be interested in one or two.

For example:

Topic
|
+-- DocumentCreated
+-- DocumentUpdated
+-- DocumentDeleted
+-- DocumentProcessed

A subscription could specify:

Included event types:
DocumentProcessed
DocumentFailed

The subscriber would not receive the other event types.

Event type filtering is one of the simplest and most important forms of Event Grid filtering.


9. Event Filtering

Event filtering is one of the most important AI-200 concepts.

Suppose a topic receives thousands of events:

DocumentCreated
DocumentUpdated
DocumentDeleted
ImageUploaded
VideoUploaded

A particular Function might only care about:

DocumentCreated

Instead of sending every event to the Function and filtering them in application code, Event Grid can filter the events before delivery.

This reduces:

  • Unnecessary network traffic
  • Function executions
  • Processing
  • Cost
  • Application complexity

Event Grid supports several filtering approaches.


10. Event Type Filtering

Event type filtering allows a subscription to receive only specific event types.

For example:

Included event types:
DocumentCreated
DocumentUpdated

Events such as:

DocumentDeleted

would not be delivered to that subscription.

This is appropriate when the routing decision is based primarily on the type of event.


11. Subject Filtering

Events have a subject that identifies the resource or object associated with the event.

For example:

/documents/invoices/2026/invoice-123.pdf

A subscription can filter based on whether the subject:

  • Begins with a specified value
  • Ends with a specified value

For example:

Subject begins with:
/documents/invoices/

would select events associated with invoice documents.

Another example:

Subject ends with:
.pdf

could be used to select PDF-related events.

Subject filtering is useful when the event type is the same but the resource or path differs.


12. Advanced Filtering

Advanced filtering provides more precise filtering based on event properties.

For example:

{
"data": {
"department": "finance",
"priority": 5,
"environment": "production"
}
}

A subscription could filter on:

data.department = "finance"

or:

data.priority > 3

or:

data.environment = "production"

Advanced filters support different data types and operators, including string, numeric, Boolean, and array-based filtering.


13. Common Advanced Filter Operators

Important operators include:

String operators

Examples include:

StringIn
StringNotIn
StringContains
StringNotContains
StringBeginsWith
StringNotBeginsWith
StringEndsWith
StringNotEndsWith

Numeric operators

Examples include:

NumberIn
NumberNotIn
NumberLessThan
NumberLessThanOrEquals
NumberGreaterThan
NumberGreaterThanOrEquals

Boolean

BoolEquals

There are also operators for null/undefined values and range-based comparisons.

For the exam, focus on understanding why you would use advanced filtering rather than memorizing every operator.


14. Example: Advanced Filtering

Imagine the application publishes:

{
"eventType": "DocumentUploaded",
"data": {
"documentType": "invoice",
"priority": 8,
"environment": "production"
}
}

A subscription might filter for:

data.documentType = invoice

This means the subscriber only receives invoice events.

Another subscription might use:

data.priority >= 7

to receive only high-priority documents.

This is much more efficient than delivering every event and performing the filtering inside the application.


15. Combining Filters

You can use multiple filters to create more selective subscriptions.

For example:

Event Type = DocumentUploaded
AND
data.documentType = invoice
AND
data.environment = production

This creates a narrowly targeted event stream.

A good event design therefore includes meaningful event metadata.

For example:

{
"eventType": "DocumentUploaded",
"subject": "/documents/12345",
"data": {
"documentType": "invoice",
"environment": "production",
"priority": 8
}
}

Good event metadata makes downstream routing much easier.


16. Designing Event Subjects

When designing custom events, don’t treat the subject as an arbitrary string.

A meaningful subject can make filtering easier.

For example:

/documents/invoices/2026/12345

is much more useful for routing than:

12345

A hierarchical subject can allow subscriptions to target broad or narrow groups of events.

For example:

/documents/invoices/

could represent all invoice documents.

A more specific path could identify:

/documents/invoices/2026/12345

This is particularly useful in large event-driven systems.


17. Event Delivery

Event Grid uses a push delivery model for many common Event Grid workflows.

When an event matches a subscription, Event Grid attempts to deliver it to the destination.

A successful HTTP response indicates successful delivery.

Event Grid considers HTTP status codes in the 200–204 range successful for delivery. Other responses are treated as failures and may result in retries or dead-lettering depending on the error and configuration.


18. At-Least-Once Delivery

One of the most important concepts for the exam is that Event Grid uses an at-least-once delivery model.

This means an event can potentially be delivered more than once.

For example:

Event published
|
v
Event Grid
|
+----> Consumer
|
+---- Processing succeeds
|
+---- Response delayed

If Event Grid cannot determine that delivery succeeded, it may retry.

The consumer could therefore receive the same event again.

Design implication

Event handlers should be idempotent whenever possible.

For example, instead of blindly performing:

Insert record

the consumer could use the event ID to determine whether it has already processed the event.


19. Event Ordering

Event Grid does not guarantee event ordering.

For example, an application might publish:

Event A
Event B
Event C

but the consumer could receive:

Event B
Event A
Event C

Therefore, applications that require strict ordering should not assume that Event Grid delivery preserves publication order.

If ordering is a hard requirement, another messaging design may be more appropriate.


20. Retry Behavior

If Event Grid cannot successfully deliver an event, it can retry delivery.

Event Grid uses an exponential-backoff-based retry schedule.

The current documented retry schedule includes progressively longer delays, beginning with short delays and eventually extending to hours. Event Grid may also delay or skip certain retries when an endpoint remains unhealthy.

The important exam concept is:

Event Grid does not immediately give up when an endpoint fails.

Instead, it attempts delivery again according to its retry behavior and configured retry policy.


21. Configurable Retry Policy

Event Grid allows you to configure two important retry limits:

  1. Maximum delivery attempts
  2. Event time-to-live (TTL)

The documented limits are:

SettingDefaultValid range
Maximum delivery attempts301–30
Event TTL1,440 minutes1–1,440 minutes

If both are configured, whichever limit is reached first determines when Event Grid stops attempting delivery.

Example

Suppose you configure:

Maximum attempts = 5
TTL = 30 minutes

If the event reaches five attempts before 30 minutes:

Stop retrying

If 30 minutes expires before five attempts occur:

Stop retrying

The retry schedule itself is not directly configurable. You configure the limits, not the individual retry intervals.


22. Dead-Lettering

When an event can no longer be delivered within the configured retry policy, you may want to preserve it instead of losing it.

This is where dead-lettering comes into play.

Event Grid can send undeliverable events to an Azure Storage Blob container.

Conceptually:

Event Grid
|
| delivery failures
v
Retry
|
| retry limit reached
v
Dead-letter storage

Dead-lettering is not enabled automatically for every subscription. You configure a storage account/container as the dead-letter destination.


23. Why Dead-Lettering Matters

Dead-lettering is particularly important when events represent business-critical operations.

Suppose an AI application generates:

DocumentProcessingCompleted

and the downstream billing system is temporarily unavailable.

Without a dead-letter destination, an event that ultimately cannot be delivered may be dropped.

With dead-lettering:

DocumentProcessingCompleted
|
v
Event Grid
|
v
Billing System
|
delivery fails
|
v
retries
|
v
Dead-letter Blob

An operations team or automated process can later inspect and reconcile those events.


24. Important HTTP Failure Behaviors

Not all HTTP errors are treated identically.

For example, certain configuration-related errors such as:

400 Bad Request
403 Forbidden
413 Request Entity Too Large

can cause Event Grid to stop retrying rather than repeatedly attempting an endpoint that is unlikely to succeed.

Other failures can result in retries.

For example:

503 Service Unavailable

is a typical transient failure for which retry behavior is appropriate.

Exam takeaway

Do not assume:

“Every failed HTTP request is retried forever.”

Event Grid distinguishes between failures and applies its delivery and retry rules accordingly.


25. Dead-Lettering vs. Retry

These concepts should not be confused.

Retry

Retry means:

“Try delivering the event again.”

Dead-letter

Dead-letter means:

“The event could not be successfully delivered within the applicable delivery policy, so preserve it for later investigation or processing.”

The general workflow is:

Publish
|
v
Deliver
|
+---- Success → Done
|
+---- Failure
|
v
Retry
|
+---- Success → Done
|
+---- Limits reached
|
v
Dead-letter

26. Delayed Delivery

Event Grid also protects unhealthy endpoints through delayed delivery.

If an endpoint repeatedly fails, Event Grid can delay subsequent deliveries to avoid overwhelming an already unhealthy system.

This is important in high-volume AI workloads.

Imagine an AI endpoint can process only 100 requests per second but suddenly receives thousands of events.

Repeatedly retrying failures immediately could make the problem worse.

Event Grid’s retry and delayed-delivery behavior helps prevent this type of cascading overload.


27. Event Grid and Azure Functions

A common AI-200 scenario is:

Event Source
|
v
Event Grid
|
v
Azure Function

For example:

Blob uploaded
|
v
Event Grid
|
v
Function
|
+---- Extract text
+---- Generate embedding
+---- Store vector

This architecture provides several advantages:

  • Serverless execution
  • Automatic scaling
  • Event-driven processing
  • Loose coupling
  • Reduced polling
  • Integration with other Azure services

However, the Function should still be designed for retries and duplicate events.


28. Event Grid and AI Workloads

Event-driven architectures are particularly useful for AI applications.

Consider a document ingestion pipeline:

Blob Storage
|
| BlobCreated
v
Event Grid
|
v
Azure Function
|
+---- Extract content
|
+---- Generate embedding
|
+---- Store in PostgreSQL
|
+---- Publish DocumentIndexed
|
v
Event Grid
|
+---- Notify application
+---- Update analytics

This creates a pipeline in which each stage can react to the completion of another stage.


29. Example: AI Image Processing

Suppose an application receives images.

When an image is uploaded:

Image Upload
|
v
Blob Storage
|
v
Event Grid
|
v
Azure Function
|
+---- Computer vision analysis
|
+---- Store results
|
+---- Publish ImageAnalyzed

Another subscriber might listen for:

ImageAnalyzed

and update a search index.

A third subscriber might send a notification.

The original uploader does not need to know about these downstream processes.


30. Designing Reliable Event Handlers

Because Event Grid can deliver events more than once, consumers should be designed appropriately.

Make operations idempotent

An operation is idempotent when executing it multiple times produces the same intended result as executing it once.

For example:

Set document status = "Processed"

is naturally more idempotent than:

Increment processed-count

If an event is delivered twice, an increment operation could incorrectly increase the count twice.


Track Event IDs

Consumers can maintain a record of processed event IDs.

For example:

Event ID: 8f72...
Status: Processed

When the same event arrives again:

Event already processed

The consumer can safely ignore it.


31. Avoiding Long-Running Event Handlers

Event handlers should generally acknowledge events promptly when possible.

A common architecture for longer AI operations is:

Event Grid
|
v
Function
|
v
Service Bus
|
v
Long-running AI Worker

The Function receives the event and places a durable work item into Service Bus.

The worker can then perform the longer operation.

This separates event notification from workload processing.


32. Event Grid Filtering vs. Application Filtering

Consider two designs.

Design A

Event Grid
|
v
Function
|
+---- Check event type
+---- Check priority
+---- Check environment

Design B

Event Grid
|
| Filter
v
Function

When the filtering criteria can be expressed through Event Grid subscription filters, Design B is generally preferable.

Benefits include:

  • Less unnecessary invocation
  • Lower processing overhead
  • Less network traffic
  • Lower cost
  • Simpler application code

This is an important architectural principle.


33. Multiple Subscribers

One of Event Grid’s strengths is that multiple subscriptions can consume the same event stream independently.

For example:

CustomerCreated
|
v
Event Grid
|
+---- Subscription 1 → CRM Function
|
+---- Subscription 2 → Analytics Function
|
+---- Subscription 3 → Notification Function

Each subscription can have its own:

  • Destination
  • Filter
  • Retry configuration
  • Dead-letter configuration

This allows one event to initiate multiple independent workflows.


34. Event Grid Delivery Batching

Event Grid normally delivers events individually.

For high-throughput scenarios, batching can be enabled.

Batching can improve HTTP efficiency by delivering multiple events in one request.

Current Event Grid push delivery supports configurable batch settings, including maximum events per batch and preferred batch size. Batching uses all-or-none semantics for a delivery request, so consumers must be able to process the entire delivered batch appropriately.

Exam consideration

If a question says:

“The application receives a very high volume of events and HTTP overhead is becoming significant.”

Consider event batching as a possible optimization.


35. Common Exam Scenario

Scenario

An AI application receives thousands of document events.

A Function should process only:

DocumentUploaded

events for:

/finance/

documents.

The best solution is to configure the Event Grid subscription with:

  • Event type filtering
  • Subject filtering

rather than sending every event to the Function.

The conceptual design is:

Event Grid
|
| Event Type = DocumentUploaded
| Subject begins with /finance/
v
Azure Function

This is more efficient than filtering inside the Function.


36. Common Exam Scenario: Custom Events

Scenario

A custom AI application needs to notify multiple independent applications whenever a document classification operation completes.

The application generates:

DocumentClassificationCompleted

Which Azure service should provide the event-routing mechanism?

Azure Event Grid is a natural choice.

A custom topic can receive the application’s events, and multiple subscriptions can route them to different handlers.


37. Common Exam Scenario: Temporary Endpoint Failure

Scenario

An Event Grid subscriber temporarily returns HTTP 503.

What should you expect?

Event Grid treats the delivery as unsuccessful and can retry according to its retry behavior.

This is different from simply assuming that the event is permanently lost.


38. Common Exam Scenario: Duplicate Events

Scenario

A Function processes an event successfully, but the response isn’t successfully acknowledged by Event Grid.

Event Grid may deliver the event again.

What should the Function do?

The Function should be designed to handle duplicate events safely.

Possible techniques include:

  • Event ID tracking
  • Idempotent writes
  • Upsert operations
  • Deduplication records
  • Transactional processing where appropriate

The key concept is:

Do not assume exactly-once delivery.


39. Common Exam Scenario: Event Loss

Scenario

A critical event must not simply disappear if the subscriber remains unavailable.

What should you configure?

Dead-lettering should be considered.

Configure an Azure Storage Blob container as the dead-letter destination so undeliverable events can be preserved for later reconciliation.


40. Common Exam Scenario: Retry Configuration

Scenario

An application should stop trying to deliver an event after either:

  • 10 delivery attempts, or
  • 60 minutes.

The Event Grid subscription can be configured with:

Maximum delivery attempts = 10
TTL = 60 minutes

Whichever limit is reached first stops the delivery attempts.


41. Key Distinctions to Remember

For the AI-200 exam, remember these distinctions:

ConceptPurpose
EventDescribes something that happened
Event sourceProduces the event
TopicEndpoint/channel for events
Custom topicTopic for application-generated events
Event subscriptionDefines routing to a destination
Event handlerProcesses the event
Event type filterSelects event types
Subject filterSelects events by subject prefix/suffix
Advanced filterFilters event properties
RetryAttempts delivery again
TTLMaximum time Event Grid attempts delivery
Maximum attemptsMaximum delivery attempts
Dead-letterStores undeliverable events
IdempotencySafely handles duplicate delivery

42. AI-200 Exam Tips

Tip 1: Event Grid is about events

If the question says:

“Something happened, and another service should react.”

Think:

Event Grid


Tip 2: Service Bus is different

If the scenario emphasizes:

  • Commands
  • Queues
  • Durable messaging
  • Competing consumers
  • Sessions
  • Transactional messaging

think:

Azure Service Bus


Tip 3: Filter before invoking

If Event Grid can filter an event, don’t automatically filter it in application code.

Event subscription filtering can reduce unnecessary processing.


Tip 4: Expect duplicates

Event Grid delivery should be treated as at least once.

Design consumers accordingly.


Tip 5: Don’t assume ordering

Event Grid does not guarantee event ordering.


Tip 6: Know retry limits

Remember:

Maximum delivery attempts
+
Event TTL

Whichever limit is reached first stops delivery attempts.


Tip 7: Know dead-lettering

Dead-lettering provides a place to preserve events that could not be delivered.

For Event Grid, the dead-letter destination uses Azure Blob Storage.


Tip 8: Understand the three major filter types

Remember:

Event type
Subject
Advanced properties

43. Summary

Azure Event Grid provides a managed mechanism for building event-driven applications by routing events from producers to subscribers.

For AI-200, the most important concepts are:

  • Event sources produce events.
  • Topics provide event publishing endpoints.
  • Custom topics support application-generated events.
  • Event subscriptions define routing.
  • Event handlers process events.
  • Event type filters select specific types of events.
  • Subject filters select events based on their subjects.
  • Advanced filters can evaluate event properties.
  • Event Grid provides retry behavior for failed deliveries.
  • Retry limits can be configured using maximum attempts and TTL.
  • Dead-lettering can preserve events that cannot be delivered.
  • Event delivery should be treated as at least once.
  • Consumers should be designed to tolerate duplicates.
  • Event ordering should not be assumed.
  • Event Grid and Service Bus solve different messaging problems.
  • Event Grid is particularly useful for loosely coupled, event-driven AI workflows.

The most important mental model is:

Something happens → Event is generated → Event Grid routes it → Matching subscription receives it → Handler processes it → Retry/dead-letter mechanisms provide resilience.


Practice Exam Questions

Question 1

An AI application publishes a DocumentProcessed event whenever document processing finishes. Several independent applications need to react to this event, and the producing application should not need to know which applications consume it.

Which Azure service is the best fit for routing these events?

A. Azure Event Grid

B. Azure Key Vault

C. Azure App Configuration

D. Azure Container Registry

Answer: A

Explanation

Azure Event Grid is designed for event routing and pub/sub scenarios. A custom topic can receive application-generated events, while multiple event subscriptions can independently route those events to different handlers.

Azure Key Vault manages secrets, App Configuration manages application configuration, and Container Registry stores container images.


Question 2

An Event Grid subscription should receive only events whose subject begins with:

/documents/invoices/

Which filtering mechanism should be used?

A. Advanced numeric filtering

B. Subject filtering

C. Event TTL

D. Maximum delivery attempts

Answer: B

Explanation

Subject filtering is specifically designed to select events based on the beginning or ending of an event’s subject.

TTL and maximum delivery attempts control delivery behavior rather than which events are selected.


Question 3

An application publishes the following event:

{
"eventType": "DocumentUploaded",
"data": {
"department": "finance",
"priority": 8
}
}

A subscriber should receive only events where data.priority is greater than or equal to 7.

Which Event Grid capability should be used?

A. Subject filtering

B. Event TTL

C. Advanced filtering

D. Dead-lettering

Answer: C

Explanation

Advanced filtering allows subscriptions to evaluate properties within the event data using operators such as NumberGreaterThanOrEquals.

Subject filtering is appropriate for the event subject, while TTL and dead-lettering concern delivery reliability.


Question 4

An Event Grid subscriber temporarily returns HTTP 503 responses because the application is unavailable. What should you expect Event Grid to do?

A. Immediately delete all affected events

B. Permanently disable the subscription

C. Retry delivery according to its retry behavior and configured limits

D. Convert the events into Service Bus messages automatically

Answer: C

Explanation

HTTP 503 represents a service-unavailable condition. Event Grid can retry failed delivery using its retry behavior. Delivery continues until successful delivery or the applicable retry policy limits are reached.

Event Grid does not automatically convert the events into Service Bus messages or permanently disable the subscription.


Question 5

A critical Event Grid event cannot be delivered after the configured retry policy is exhausted. The organization needs to preserve the event for later investigation.

What should you configure?

A. A dead-letter destination in Azure Blob Storage

B. An Azure Container Registry

C. An Azure App Configuration store

D. An Azure Key Vault secret

Answer: A

Explanation

Event Grid supports dead-lettering to an Azure Storage Blob container. Undeliverable events can be stored there for later inspection and reconciliation.

The other services do not provide Event Grid dead-letter storage.


Question 6

An Event Grid subscription is configured with:

Maximum delivery attempts = 5
TTL = 60 minutes

The event reaches five delivery attempts after only 12 minutes. What happens next?

A. Event Grid continues retrying until 60 minutes have elapsed

B. Event Grid stops delivery attempts because the maximum attempt limit was reached

C. Event Grid automatically changes the maximum attempts to 30

D. Event Grid immediately sends the event to every other subscription

Answer: B

Explanation

When both maximum delivery attempts and TTL are configured, the first limit reached determines when Event Grid stops delivery attempts.

Because five attempts have occurred before the 60-minute TTL expires, the maximum-attempt limit is reached first.

If dead-lettering is configured, the event can then be dead-lettered.


Question 7

An AI application processes DocumentProcessed events. Occasionally, the same event is delivered twice. The application currently increments a counter every time it receives the event, causing inaccurate results.

What is the best design improvement?

A. Increase the event TTL

B. Disable event filtering

C. Make the event-processing operation idempotent

D. Increase the number of Event Grid subscriptions

Answer: C

Explanation

Event Grid uses at-least-once delivery semantics, so consumers must be prepared for duplicate events.

An idempotent operation can safely process the same event multiple times without producing an incorrect result. Event IDs can also be tracked to implement deduplication.

Changing TTL, filtering, or subscription count does not solve the fundamental duplicate-processing problem.


Question 8

An application generates its own events and needs an Event Grid endpoint to which it can publish those events.

Which resource should the application use?

A. Azure Service Bus session

B. Azure Event Hubs consumer group

C. Azure Storage queue

D. An Azure Event Grid custom topic

Answer: D

Explanation

A custom Event Grid topic provides a user-defined endpoint for applications to publish their own events.

Service Bus, Event Hubs, and Storage queues have different messaging purposes and do not represent the Event Grid custom-topic publishing model.


Question 9

An Event Grid subscription should receive only events of these types:

DocumentCreated
DocumentUpdated

It should not receive:

DocumentDeleted

Which configuration should be used?

A. Included event type filtering

B. Dead-lettering

C. Event TTL

D. Maximum delivery attempts

Answer: A

Explanation

Event type filtering allows a subscription to specify which event types it should receive.

The other options control delivery reliability rather than event selection.


Question 10

An AI application receives a very high volume of Event Grid events. HTTP request overhead is becoming significant, and the event-processing service can efficiently process multiple events in a single request.

Which Event Grid capability should be considered?

A. Dead-lettering

B. Event delivery batching

C. Subject filtering

D. Event TTL reduction

Answer: B

Explanation

Event Grid supports batching for push delivery. Instead of sending every event in an individual delivery request, multiple events can be delivered together.

Batching can improve HTTP efficiency in high-throughput scenarios. The consumer must be designed to process the batch appropriately because Event Grid uses all-or-none semantics for a batch delivery request.


Final Exam Takeaways

Before taking the AI-200 exam, make sure you can confidently answer these questions:

  1. When should I use Event Grid?
    For event-driven routing and reacting to things that happened.
  2. When should I consider Service Bus instead?
    When the scenario calls for durable messaging, queues, commands, sessions, or sophisticated message-processing patterns.
  3. How do I create application-generated events?
    Publish them to an Event Grid custom topic.
  4. How do I control which events a subscriber receives?
    Use event type, subject, and advanced filters.
  5. What happens when delivery fails?
    Event Grid can retry according to its retry behavior.
  6. What controls how long Event Grid retries?
    Event TTL and maximum delivery attempts.
  7. What happens when delivery ultimately fails?
    With dead-lettering configured, the event can be stored in Azure Blob Storage.
  8. Can an event be delivered more than once?
    Yes. Design consumers to tolerate duplicates.
  9. Does Event Grid guarantee event ordering?
    No.
  10. How can high-volume delivery be optimized?
    Consider event batching where the consumer supports it.

If you understand those ten points—and especially the distinctions between event filtering, retry, TTL, dead-lettering, and idempotent processing—you’ll have a strong foundation for the Event Grid portion of AI-200.


Go to the AI-200 Exam Prep Hub main page

Choose from full-text, semantic vector, and hybrid search (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement intelligent search
      --> Choose from full-text, semantic vector, and hybrid search


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

One of the most important skills measured on the DP-800 exam is knowing which search technology is appropriate for different AI-enabled database scenarios. Modern applications no longer rely solely on keyword matching. Instead, they increasingly combine traditional SQL capabilities with semantic understanding powered by embeddings and vector databases.

Microsoft SQL Server 2025, Azure SQL Database, Azure SQL Managed Instance, Azure AI Search, and Microsoft Fabric all support architectures that combine relational data with AI-powered retrieval.

The DP-800 exam expects candidates to understand:

  • Traditional Full-Text Search
  • Semantic Vector Search
  • Hybrid Search
  • When each technique should be selected
  • Advantages and disadvantages of each approach
  • How embeddings enable semantic retrieval
  • How intelligent search supports Retrieval-Augmented Generation (RAG)

Understanding the strengths and weaknesses of each search strategy is critical because choosing the wrong approach can significantly reduce application quality, increase cost, or degrade performance.


Why Intelligent Search Matters

Traditional databases are excellent at retrieving structured information.

For example:

Find all customers named Smith.

or

Find invoices created after January 1.

However, AI applications often ask questions like:

  • Which support ticket is similar to this one?
  • Find documents about password recovery.
  • Find articles discussing authentication failures.
  • Recommend products similar to this description.

These questions require understanding meaning, not merely matching characters.

This is why semantic search has become an essential component of modern database applications.


Three Primary Search Approaches

Microsoft generally categorizes intelligent search into three approaches:

  1. Full-Text Search
  2. Semantic Vector Search
  3. Hybrid Search

Each solves a different problem.


Full-Text Search

Full-text search is Microsoft’s traditional text search technology.

Instead of scanning every row with LIKE comparisons, SQL Server builds specialized indexes that understand words and language.

Example:

Find all documents containing:
database
security
Azure

Rather than performing:

WHERE Description LIKE '%Azure%'

Full-text indexes tokenize words and search efficiently.


Full-Text Search Features

Supports:

  • Word searches
  • Phrase searches
  • Prefix searches
  • Inflectional forms
  • Language-specific stemming
  • Stop words
  • Ranking

Example:

Searching for

run

may also find

  • running
  • runs
  • ran

depending on language settings.


Full-Text Index Architecture

A full-text index stores:

  • Tokens
  • Word locations
  • Linguistic metadata

instead of raw text.

This allows much faster retrieval than LIKE queries.


Common Full-Text Functions

Examples include:

CONTAINS()
FREETEXT()
CONTAINSTABLE()
FREETEXTTABLE()

Example:

SELECT *
FROM Articles
WHERE CONTAINS(Content,'Azure');

Advantages of Full-Text Search

Advantages include:

  • Mature technology
  • Extremely fast keyword searches
  • Built directly into SQL Server
  • Efficient indexing
  • Supports ranking
  • Low storage overhead
  • Easy implementation

Limitations of Full-Text Search

It still relies primarily on matching words.

It does not understand meaning.

For example:

Search:

vehicle repair

A document containing

automobile maintenance

might not be returned.

Although synonyms can sometimes help, semantic understanding remains limited.


When Full-Text Search Is Best

Choose Full-Text Search when:

  • Exact words matter
  • Legal document searches
  • Product catalogs
  • Article searches
  • Documentation portals
  • Knowledge bases
  • Compliance systems

It excels when users know the terminology they are searching for.


Semantic Vector Search

Vector search is fundamentally different.

Instead of searching words, it searches meaning.

The process is:

Text

Embedding model

Vector

Similarity search

Every document becomes a numerical representation.

Example:

"Reset your password"

becomes

[0.183,
-0.912,
0.447,
...]

The numbers themselves are not important.

Their relative position in vector space is.


Embeddings Power Semantic Search

Embedding models place similar concepts near each other.

For example:

Dog

and

Puppy

produce vectors close together.

Likewise:

Laptop

and

Notebook computer

may generate highly similar vectors.

The model learns semantic relationships.


Similarity Search

Rather than asking:

“Does this document contain this word?”

Vector search asks:

“Which vectors are closest?”

Similarity is commonly measured using:

  • Cosine similarity
  • Euclidean distance
  • Dot product

Cosine similarity is the most common metric.


Example

User asks:

“How do I recover my account?”

Stored article:

“Reset your password”

Even though no identical words exist, vector search recognizes the concepts are related.

This is impossible using ordinary keyword matching.


Advantages of Semantic Vector Search

Benefits include:

  • Understands meaning
  • Finds similar content
  • Supports natural language
  • Excellent for AI assistants
  • Ideal for RAG
  • Handles synonyms automatically
  • Better user experience

Limitations of Vector Search

Tradeoffs include:

  • Requires embedding models
  • Consumes more storage
  • Embedding generation costs compute
  • Requires vector indexes
  • More complex infrastructure
  • Results can occasionally be less predictable than exact keyword searches

Typical Use Cases

Vector search is ideal for:

  • AI chatbots
  • Enterprise search
  • Recommendation engines
  • Similar document retrieval
  • Customer support assistants
  • Semantic knowledge bases
  • Question answering systems
  • RAG architectures

Understanding Hybrid Search

Neither full-text nor vector search is perfect for every workload.

Hybrid search combines both approaches.

Instead of choosing one search method, the application performs:

  • Full-text search
  • Vector search

simultaneously.

Results are then merged and ranked.

This provides higher-quality search than either technique alone.


Why Hybrid Search Works

Imagine a user searches:

“Azure SQL backup”

Keyword search finds:

  • Azure SQL backup documentation

Vector search finds:

  • Disaster recovery guidance
  • Database restore procedures
  • Business continuity articles

Combining both returns a richer, more relevant result set.


Benefits of Hybrid Search

Hybrid search offers:

  • Higher recall
  • Better ranking
  • Exact keyword matches
  • Semantic understanding
  • More complete search results
  • Improved user satisfaction
  • Better grounding for AI responses

Hybrid Search in RAG

Retrieval-Augmented Generation depends heavily on retrieving the most relevant context.

Hybrid search often performs best because it retrieves:

  • Exact terminology
  • Related concepts
  • Similar documents

The LLM then generates an answer using higher-quality evidence.

This significantly reduces hallucinations.


Choosing the Right Search Method

RequirementBest Choice
Exact keywordsFull-Text Search
SQL documentation searchFull-Text Search
Product SKU lookupFull-Text Search
Semantic similarityVector Search
AI chatbotVector Search
Recommendation engineVector Search
RAG systemHybrid Search
Enterprise searchHybrid Search
Large knowledge baseHybrid Search
Customer support assistantHybrid Search

Comparison Table

FeatureFull-TextVectorHybrid
Keyword matchingExcellentPoorExcellent
Semantic understandingNoYesYes
Finds synonymsLimitedExcellentExcellent
Natural language queriesLimitedExcellentExcellent
Requires embeddingsNoYesYes
Requires vector indexNoYesYes
Best for RAGFairGoodExcellent
AI chatbot supportLimitedExcellentExcellent
Traditional SQL workloadsExcellentModerateGood
ComplexityLowMediumHigher

DP-800 Exam Tips

Remember these key distinctions:

  • Full-text search is optimized for exact words and phrases.
  • Vector search retrieves semantically similar content using embeddings.
  • Hybrid search combines keyword precision with semantic relevance.
  • Embeddings are required only for vector and hybrid search.
  • Hybrid search is generally the preferred approach for enterprise AI assistants and RAG solutions because it balances precision and recall.
  • LIKE queries are not substitutes for full-text indexes in large-scale search applications.
  • Expect scenario-based questions asking you to recommend the most appropriate search technology based on application requirements, performance, and user experience.

Practice Exam Questions


Question 1

A development team is building an enterprise knowledge base for an AI chatbot. Users ask questions in natural language, and the chatbot retrieves relevant documents before generating a response.

Which search approach should you recommend?

A. Full-text search only

B. Semantic vector search

C. LIKE queries

D. Indexed views

Correct Answer: B

Explanation:
Semantic vector search uses embeddings to retrieve documents based on meaning rather than exact keywords. This makes it ideal for AI chatbots and Retrieval-Augmented Generation (RAG). LIKE queries and indexed views do not provide semantic understanding, while full-text search is limited to keyword matching.


Question 2

A legal department maintains millions of contracts. Attorneys usually know the exact legal terms they are searching for and require fast, precise keyword matching.

Which search technology is the best fit?

A. Hybrid search

B. Semantic vector search

C. Full-text search

D. Azure AI embeddings only

Correct Answer: C

Explanation:
Full-text search is optimized for exact words, phrases, stemming, ranking, and efficient indexing. Since attorneys typically search using precise terminology, full-text search provides the best balance of performance and accuracy.


Question 3

A company stores product manuals and wants search results to include documents discussing “automobile maintenance” when users search for “car repair.”

Which search capability provides this behavior?

A. SQL LIKE operator

B. Clustered indexes

C. Full-text search only

D. Semantic vector search

Correct Answer: D

Explanation:
Semantic vector search retrieves content based on meaning instead of exact words. Because embedding models understand semantic relationships, they recognize that “car repair” and “automobile maintenance” describe similar concepts.


Question 4

A RAG application must retrieve documents that contain both exact product names and semantically similar troubleshooting articles.

Which search strategy should you recommend?

A. Full-text search

B. LIKE queries

C. Hybrid search

D. Clustered columnstore indexes

Correct Answer: C

Explanation:
Hybrid search combines full-text search with semantic vector search. Exact product names are retrieved through keyword matching, while related troubleshooting content is found using semantic similarity.


Question 5

Which characteristic is unique to semantic vector search?

A. It stores documents in XML format.

B. It searches using vector similarity instead of exact text matching.

C. It requires clustered indexes.

D. It eliminates the need for embeddings.

Correct Answer: B

Explanation:
Semantic vector search converts content into embeddings and compares vectors using similarity metrics such as cosine similarity. It does not rely on exact text matching.


Question 6

Your application must support searches for:

  • “running”
  • “runs”
  • “ran”

using a single search term.

Which technology provides this capability without AI embeddings?

A. Full-text search

B. Azure OpenAI

C. Semantic vector search

D. Azure AI Search only

Correct Answer: A

Explanation:
Full-text search supports stemming and inflectional forms, allowing different grammatical variations of a word to match automatically without requiring embeddings.


Question 7

Which similarity metric is most commonly associated with vector search?

A. SHA-256

B. CRC32

C. Cosine similarity

D. Binary comparison

Correct Answer: C

Explanation:
Cosine similarity is the most widely used metric for measuring how similar two embedding vectors are by comparing the angle between them rather than their magnitude.


Question 8

An organization wants users to receive highly relevant search results even when they misspell keywords or use different terminology.

Which search method generally provides the highest quality results?

A. LIKE queries

B. Full-text search only

C. Hybrid search

D. Primary key lookups

Correct Answer: C

Explanation:
Hybrid search combines keyword matching with semantic understanding, improving recall and relevance by returning both exact matches and conceptually related documents.


Question 9

A database developer asks why embeddings are required for semantic search.

What is the primary purpose of embeddings?

A. Encrypt database rows.

B. Compress database backups.

C. Replace SQL indexes.

D. Represent content numerically so semantic similarity can be calculated.

Correct Answer: D

Explanation:
Embeddings transform text into high-dimensional numerical vectors that capture semantic meaning. Similar vectors represent similar concepts, enabling semantic search.


Question 10

Which scenario is the strongest candidate for using hybrid search instead of only full-text search?

A. Searching employee IDs

B. Retrieving rows by primary key

C. Supporting an AI assistant that answers questions using company documentation

D. Looking up invoice numbers

Correct Answer: C

Explanation:
AI assistants benefit from hybrid search because they require both exact keyword matching and semantic understanding. Hybrid search improves document retrieval quality, which directly improves the quality of RAG-generated responses.


DP-800 Exam Tips

  • Full-text search is best for exact keywords, phrases, and language-aware searches using stemming and ranking.
  • Semantic vector search retrieves information based on meaning by comparing embeddings with similarity metrics such as cosine similarity.
  • Hybrid search combines keyword precision with semantic relevance and is generally the preferred approach for enterprise AI search and RAG solutions.
  • Embeddings are required for vector and hybrid search but not for traditional full-text search.
  • Expect scenario-based exam questions where you must recommend the most appropriate search technology based on user requirements, data type, query style, and application architecture.
  • Remember that LIKE queries are suitable only for simple pattern matching and are not a replacement for full-text or semantic search in large-scale intelligent applications.

Go to the DP-800 Exam Prep Hub main page

Implement full-text search (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement intelligent search
      --> Implement full-text search


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Full-text search is one of the foundational search technologies available in Microsoft SQL Server and Azure SQL Managed Instance. Unlike traditional SQL searches that rely on exact text matching through operators such as LIKE, full-text search provides a much more efficient and intelligent mechanism for searching large collections of textual data.

For the DP-800: Developing AI-Enabled Database Solutions exam, you should understand:

  • What full-text search is
  • When it should be used
  • How it works internally
  • Full-text indexes and catalogs
  • Supported query predicates and functions
  • Language-aware searching
  • Stoplists and thesaurus files
  • Ranking search results
  • Performance considerations
  • When to choose full-text search instead of vector or hybrid search

Although AI-powered semantic search is becoming increasingly popular, full-text search remains an important technology for applications that require fast keyword-based retrieval.


What Is Full-Text Search?

Full-text search is a SQL Server feature that enables efficient searching of large text columns.

Unlike:

WHERE Description LIKE '%backup%'

full-text search creates a specialized index that understands words rather than simple character sequences.

It supports searching within:

  • CHAR
  • VARCHAR
  • NCHAR
  • NVARCHAR
  • TEXT (legacy)
  • NTEXT (legacy)
  • XML
  • FILESTREAM documents through filters

Instead of scanning every row, SQL Server searches an optimized full-text index.


Why Traditional LIKE Queries Are Limited

Many developers initially use:

SELECT *
FROM Articles
WHERE Content LIKE '%security%'

Although this works, it has several disadvantages:

  • Table scans on large datasets
  • Poor performance
  • Cannot rank results
  • No language awareness
  • No stemming
  • No synonym support
  • Limited search capabilities

For enterprise search applications, LIKE queries do not scale effectively.


Benefits of Full-Text Search

Full-text search provides:

  • Fast keyword searches
  • Phrase searching
  • Prefix matching
  • Inflectional searches
  • Linguistic processing
  • Word breaking
  • Ranking of results
  • Stop word removal
  • Efficient indexing
  • Large-scale text retrieval

Full-Text Search Architecture

Several components work together.

Source Tables

Contain text data.

Example:

Articles
Products
KnowledgeBase
SupportTickets
Policies

Full-Text Index

Instead of indexing every character, SQL Server stores:

  • Tokens
  • Word positions
  • Language metadata

This dramatically speeds searches.


Full-Text Catalog

A full-text catalog is a logical container for one or more full-text indexes.

Modern SQL Server versions automatically manage catalogs, but understanding the concept remains important for the DP-800 exam.


Word Breakers

SQL Server separates text into words using language-specific rules.

Example:

SQL Server enables intelligent search.

becomes

SQL
Server
enables
intelligent
search

Different languages use different tokenization rules.


Stemmers

Stemmers recognize grammatical variations.

Searching:

run

may also find

  • running
  • runs
  • ran

depending on the configured language.


Enabling Full-Text Search

Before using full-text search:

  1. Install Full-Text Search feature.
  2. Create a unique key index.
  3. Create a full-text catalog (optional in newer versions).
  4. Create a full-text index.

Example:

CREATE FULLTEXT INDEX
ON Articles(Content)
KEY INDEX PK_Articles;

The index is then populated.


Full-Text Predicates

The DP-800 exam expects familiarity with common predicates.


CONTAINS()

Searches for precise words or phrases.

Example:

SELECT *
FROM Articles
WHERE CONTAINS(Content,'Azure');

Phrase Search

CONTAINS(Content,'"Azure SQL"')

Returns only rows containing the complete phrase.


Boolean Operators

Supports:

AND
OR
AND NOT

Example:

CONTAINS(Content,'"Azure" AND "Backup"')

Prefix Search

CONTAINS(Content,'"cloud*"')

Matches

  • cloud
  • clouds
  • cloud-based
  • clouding

Proximity Search

Finds words located near each other.

Example:

database NEAR backup

Useful when context matters.


FREETEXT()

Unlike CONTAINS(), FREETEXT searches for the meaning of words rather than exact expressions.

Example:

SELECT *
FROM Articles
WHERE FREETEXT(Content,'database recovery');

SQL Server automatically considers:

  • synonyms
  • stemming
  • inflectional forms

It is more natural-language oriented than CONTAINS().


Ranking Results

Often multiple documents match.

SQL Server can assign relevance rankings.

Functions include:

CONTAINSTABLE()
FREETEXTTABLE()

Example:

SELECT *
FROM CONTAINSTABLE
(
Articles,
Content,
'Azure'
)

Returns:

  • KEY
  • RANK

Applications can sort using the ranking score.


Stoplists

Certain words appear so frequently that indexing them offers little value.

Examples:

  • the
  • is
  • and
  • a
  • of

These are called stop words.

Stoplists improve:

  • Index size
  • Query performance
  • Search quality

Custom stoplists may also be created.


Thesaurus Files

SQL Server supports synonym expansion through thesaurus XML files.

Example:

Searching:

car

may automatically include

automobile
vehicle

This improves keyword searches without requiring embeddings.


Supported Languages

Full-text search supports dozens of languages.

Language-specific processing includes:

  • tokenization
  • stemming
  • stop words
  • word breakers

Examples include:

  • English
  • French
  • German
  • Spanish
  • Japanese
  • Chinese

Each language has its own linguistic rules.


Maintaining Full-Text Indexes

Indexes require updates when data changes.

Population modes include:

Full Population

Rebuilds the entire index.

Suitable for:

  • initial creation
  • major updates

Automatic Change Tracking

Automatically updates the index after data modifications.

Recommended for most OLTP workloads.


Manual Population

Administrators trigger updates manually.

Useful when:

  • large batch loads occur
  • maintenance windows exist

Performance Considerations

Full-text search is highly optimized but requires planning.

Consider:

  • index storage
  • population time
  • update frequency
  • large document sizes
  • language configuration
  • stoplists

For massive document repositories, automatic population should be monitored to avoid excessive resource usage.


When to Use Full-Text Search

Choose full-text search when users search by:

  • keywords
  • phrases
  • document titles
  • product names
  • legal terminology
  • technical documentation

Examples:

  • Knowledge bases
  • Product catalogs
  • Documentation portals
  • Legal document repositories
  • Medical reference systems

When NOT to Use Full-Text Search

Full-text search is not ideal when users expect semantic understanding.

Example:

User searches:

“recover my account”

Stored document:

“reset your password”

These phrases contain different words.

Full-text search may not match them effectively.

Semantic vector search would perform much better.


Full-Text Search vs LIKE

FeatureLIKEFull-Text Search
PerformancePoor on large tablesExcellent
Uses indexesLimitedSpecialized full-text indexes
Phrase searchLimitedYes
Word stemmingNoYes
Stop wordsNoYes
RankingNoYes
Prefix searchLimitedYes
Language awarenessNoYes

Full-Text Search vs Semantic Vector Search

FeatureFull-TextVector Search
Keyword matchingExcellentLimited
Semantic understandingNoExcellent
Embeddings requiredNoYes
Natural languageLimitedExcellent
Synonym understandingLimitedExcellent
AI chatbot supportModerateExcellent
RAG supportModerateExcellent
ComplexityLowMedium

Common DP-800 Scenarios

Scenario 1

A legal team searches contracts using exact legal terminology.

Best solution: Full-text search.


Scenario 2

A documentation portal searches millions of technical articles.

Best solution: Full-text search.


Scenario 3

An AI assistant answers questions using company documentation.

Best solution: Hybrid search (full-text + vector search).


Scenario 4

A recommendation engine finds similar documents.

Best solution: Vector search.


Best Practices

  • Use full-text indexes instead of LIKE for large text searches.
  • Configure the correct language for linguistic processing.
  • Enable automatic change tracking for frequently updated data.
  • Use stoplists to reduce index size and improve relevance.
  • Use CONTAINS() for precise searches and FREETEXT() for natural-language style queries.
  • Use CONTAINSTABLE() or FREETEXTTABLE() when relevance ranking is required.
  • Consider hybrid search when applications require both keyword precision and semantic understanding.
  • Monitor full-text index population and maintenance in production environments.

DP-800 Exam Tips

  • Know the differences between CONTAINS(), FREETEXT(), CONTAINSTABLE(), and FREETEXTTABLE().
  • Understand how full-text indexes differ from traditional SQL indexes.
  • Remember that full-text search is keyword-based, while vector search is meaning-based.
  • Understand the purpose of stoplists, word breakers, stemmers, and thesaurus files.
  • Expect scenario-based questions asking you to choose between LIKE queries, full-text search, vector search, and hybrid search based on application requirements.
  • Know when full-text search is sufficient and when semantic search or hybrid search provides a better user experience.

Practice Exam Questions


Question 1

A company stores millions of technical articles in an Azure SQL Database. Users frequently search for exact product names and technical terms. Developers currently use the following query:

SELECT *
FROM Articles
WHERE Content LIKE '%Azure SQL%'

The search is becoming increasingly slow as the table grows.

Which feature should you recommend?

A. Full-text search
B. Columnstore indexes
C. Semantic vector search
D. Table partitioning

Correct Answer: A

Explanation

Full-text search is specifically designed for efficient searching of large text columns. It creates specialized indexes that support keyword searches, phrase matching, ranking, and linguistic analysis. While table partitioning and columnstore indexes improve other workloads, they do not replace full-text search functionality.


Question 2

Which SQL Server function searches for exact words, phrases, Boolean expressions, and prefix terms?

A. FREETEXT()
B. CONTAINS()
C. PATINDEX()
D. CHARINDEX()

Correct Answer: B

Explanation

CONTAINS() supports advanced search expressions including:

  • Exact words
  • Exact phrases
  • Boolean operators (AND, OR, AND NOT)
  • Prefix searches
  • Proximity searches

FREETEXT() is intended for natural-language searching rather than precise keyword expressions.


Question 3

A developer wants search results to include different grammatical forms of the word run, such as:

  • running
  • runs
  • ran

Which SQL Server component provides this capability?

A. Stoplists

B. Full-text catalogs

C. Stemmers

D. Clustered indexes

Correct Answer: C

Explanation

Stemmers recognize different inflectional forms of words based on language-specific rules. This allows a search for “run” to also return documents containing “running,” “runs,” or “ran.”


Question 4

Which statement best describes a full-text catalog?

A. It stores database backups.

B. It replaces clustered indexes.

C. It is a logical container that organizes one or more full-text indexes.

D. It stores vector embeddings.

Correct Answer: C

Explanation

A full-text catalog is a logical container for full-text indexes. While SQL Server automatically manages catalogs in newer versions, understanding their role remains important for administration and exam scenarios.


Question 5

Which function is most appropriate when users enter natural-language search phrases rather than precise keywords?

A. CONTAINS()

B. LIKE

C. FREETEXT()

D. PATINDEX()

Correct Answer: C

Explanation

FREETEXT() performs natural-language searches by considering linguistic analysis, stemming, and synonyms. It is designed for less structured search input compared to CONTAINS().


Question 6

Which full-text search feature helps reduce index size by excluding commonly occurring words such as the, is, and and?

A. Word breakers

B. Stoplists

C. Stemmers

D. Ranking tables

Correct Answer: B

Explanation

Stoplists contain common words, known as stop words, that are ignored during indexing and searching. This improves both index efficiency and search relevance.


Question 7

Your application must display search results ordered from the most relevant document to the least relevant.

Which functions are specifically designed for this purpose?

A. CONTAINS() and FREETEXT()

B. LIKE and PATINDEX()

C. CONTAINSTABLE() and FREETEXTTABLE()

D. CHARINDEX() and STRING_SPLIT()

Correct Answer: C

Explanation

CONTAINSTABLE() and FREETEXTTABLE() return a RANK value that indicates the relevance of each result, allowing applications to sort documents by search quality.


Question 8

Which scenario is the best use case for traditional full-text search?

A. Finding semantically similar customer support tickets

B. Building a Retrieval-Augmented Generation (RAG) chatbot

C. Recommending similar research papers based on meaning

D. Searching legal documents using exact legal terminology

Correct Answer: D

Explanation

Full-text search excels when users search using precise words and phrases, making it well suited for legal, compliance, technical documentation, and product catalog scenarios. Semantic vector search is generally preferred for AI assistants and recommendation systems.


Question 9

Which component is responsible for separating text into searchable words based on language-specific rules?

A. Word breakers

B. Stoplists

C. Embedding models

D. Full-text catalogs

Correct Answer: A

Explanation

Word breakers tokenize text into individual searchable terms according to the linguistic rules of the configured language. Proper tokenization is essential for accurate indexing and querying.


Question 10

A company is building an AI-powered knowledge assistant. Users expect searches such as:

“recover my account”

to return documents titled:

“reset your password”

Which recommendation is most appropriate?

A. Continue using LIKE queries

B. Use only full-text search

C. Replace all searches with clustered indexes

D. Combine full-text search with semantic vector search using hybrid search

Correct Answer: D

Explanation

Full-text search primarily matches keywords and phrases, while semantic vector search retrieves documents based on meaning. Hybrid search combines both approaches, producing more accurate results for AI-powered applications such as RAG systems and enterprise knowledge assistants.


DP-800 Exam Tips

  • Use full-text search when exact keywords, phrases, and language-aware matching are required.
  • Understand the differences between CONTAINS(), FREETEXT(), CONTAINSTABLE(), and FREETEXTTABLE().
  • Remember that word breakers tokenize text, stemmers recognize grammatical variations, and stoplists remove common words to improve search efficiency.
  • Use ranking functions when applications need to order search results by relevance.
  • Recognize that LIKE queries are not appropriate for large-scale enterprise text search.
  • Know that full-text search is keyword-based, while vector search is meaning-based; hybrid search combines the strengths of both and is often the preferred approach for AI-enabled search solutions.

Go to the DP-800 Exam Prep Hub main page

Design for vector data, including vector data type, vector indexes, and size (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement intelligent search
      --> Design for vector data, including vector data type, vector indexes, and size


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Modern AI-enabled applications increasingly rely on vector data to represent the meaning of text, images, audio, and other unstructured information. Instead of matching exact words, vector-based search enables applications to find content based on semantic similarity.

Microsoft SQL Server 2025, Azure SQL Database, and Azure SQL Managed Instance introduce native support for vector data, allowing databases to store embeddings directly alongside relational data. Combined with AI models and vector indexes, SQL databases become powerful platforms for semantic search, Retrieval-Augmented Generation (RAG), recommendation engines, document similarity, and AI assistants.

For the DP-800 exam, candidates should understand how to:

  • Design schemas that store vector embeddings
  • Choose appropriate vector dimensions
  • Understand vector data types
  • Create and maintain vector indexes
  • Balance storage, performance, and accuracy
  • Select index types appropriate for AI workloads
  • Understand how vector size affects database performance

What Is Vector Data?

A vector is a numerical representation of data generated by an embedding model.

Instead of storing text directly, the model converts text into hundreds or thousands of floating-point numbers.

Example:

Original text:

“Azure SQL supports AI-powered search.”

Embedding:

[0.012,
-0.553,
0.441,
...
0.318]

This numerical representation captures semantic meaning.

Documents discussing:

  • AI databases
  • Azure SQL
  • semantic search

will produce vectors located close together within vector space.


Why Store Vectors in SQL?

Traditionally, embeddings were stored in external vector databases.

Modern SQL databases now support vectors directly, allowing organizations to:

  • Keep structured and unstructured data together
  • Simplify architecture
  • Reduce synchronization complexity
  • Improve transactional consistency
  • Query relational and vector data simultaneously

Example table:

ProductIDNameCategoryDescriptionDescriptionEmbedding
101LaptopElectronicsPortable computerVector

This allows applications to perform:

  • SQL filtering
  • joins
  • semantic search

within one query.


Understanding the Vector Data Type

The new VECTOR data type stores embeddings efficiently inside SQL tables.

Example:

VECTOR(1536)

The number specifies the vector dimensions.

Examples:

VECTOR(768)
VECTOR(1024)
VECTOR(1536)
VECTOR(3072)

The dimension must exactly match the embedding model.


What Are Vector Dimensions?

Each embedding model outputs a fixed number of values.

Examples:

ModelTypical Dimensions
Small embedding model768
text-embedding-3-small1536
text-embedding-3-large3072

If an embedding model generates 1536 values:

VECTOR(1536)

must be used.

Using the wrong size causes insert failures.


Choosing the Correct Vector Size

Higher dimensions provide richer semantic meaning.

However they also require:

  • more storage
  • larger indexes
  • slower searches
  • additional memory

Example comparison:

DimensionsCharacteristics
256Very small, fast, lower accuracy
768Good balance
1024Higher quality
1536Excellent semantic understanding
3072Highest quality but larger storage

Choosing unnecessarily large vectors wastes storage.


How Embedding Size Affects Storage

Each dimension stores a floating-point number.

Example:

1536 dimensions

≈1536 floating point values

Across one million rows:

1,000,000 vectors
×
1536 dimensions

This becomes a significant storage requirement.

Large AI applications should estimate storage before deployment.


Designing Tables for Vector Data

Common design:

Documents
------------
DocumentID
Title
Category
Content
Embedding

The embedding column stores semantic meaning.

Other columns remain relational.

This design enables hybrid queries.


Separating Embeddings from Business Data

Many organizations separate embeddings into another table.

Example:

Documents
DocumentID
Title
Content
DocumentEmbeddings
DocumentID
Embedding
ModelVersion
CreatedDate

Benefits:

  • easier regeneration
  • reduced locking
  • independent maintenance
  • multiple embedding versions

Versioning Embeddings

Embedding models evolve.

Example:

Version 1:

text-embedding-3-small

Later:

text-embedding-3-large

A model change usually requires regenerating all vectors.

Many databases store:

  • Model Name
  • Version
  • Generation Date

This allows safe migrations.


One Embedding or Multiple?

Some applications store several embeddings.

Example:

Products

  • Title embedding
  • Description embedding
  • Review embedding

Different searches can target different meanings.


Designing for Chunk-Level Embeddings

Large documents are usually divided into chunks.

Instead of:

Entire PDF
One vector

Applications store:

Document
Paragraphs
One vector per paragraph

Benefits include:

  • higher search precision
  • better RAG responses
  • smaller embeddings
  • improved relevance

Vector Search vs Traditional Search

Traditional search matches keywords.

Example:

Search:

vehicle

Document:

car

Keyword search may miss it.

Vector search recognizes semantic similarity.

It understands:

  • automobile
  • vehicle
  • car
  • SUV

are closely related.


Combining SQL Filters with Vector Search

One major benefit of SQL databases is combining structured filters with AI search.

Example:

Category = Electronics
AND
Vector similarity

Only electronics are searched semantically.

This improves both performance and relevance.


Exact Search vs Approximate Search

Vector searches generally use two approaches.

Exact Search

Compares every vector.

Advantages:

  • highest accuracy

Disadvantages:

  • slower
  • expensive for large datasets

Approximate Search

Uses specialized indexes.

Advantages:

  • much faster
  • scalable

Tradeoff:

  • slight reduction in accuracy

Most production AI systems use approximate search.


Understanding Vector Indexes

Without indexes:

Every vector must be compared.

1 million vectors
1 million comparisons

Vector indexes dramatically reduce work.

They organize vectors based on similarity.

This enables very fast nearest-neighbor searches.


Approximate Nearest Neighbor (ANN)

Modern vector databases commonly use ANN indexing.

Instead of checking every vector:

Search
Relevant region
Nearby vectors
Best matches

Response times become milliseconds instead of seconds.


Why Vector Indexes Matter

Benefits include:

  • faster semantic search
  • reduced CPU usage
  • scalable AI applications
  • improved RAG performance
  • lower query latency

Large AI systems depend heavily on vector indexing.


Choosing Whether to Create a Vector Index

Small datasets:

A vector index may not provide significant benefit.

Large datasets:

Vector indexes become essential.

Typical guidance:

RowsRecommendation
ThousandsOptional
Hundreds of thousandsRecommended
MillionsEssential

Best Practices

  • Use the embedding dimensions required by the selected model.
  • Store vectors in dedicated VECTOR columns.
  • Keep relational data alongside embeddings whenever practical.
  • Separate embeddings into dedicated tables when frequent regeneration is expected.
  • Track embedding model versions.
  • Chunk large documents before generating embeddings.
  • Choose the smallest embedding model that delivers acceptable quality.
  • Create vector indexes for large datasets.
  • Combine relational filtering with semantic search.
  • Monitor storage growth as embeddings increase.

Common Exam Tips

  • Know that VECTOR stores embedding data.
  • Understand that vector dimensions must match the embedding model.
  • Remember that larger vectors increase storage and memory requirements.
  • Recognize that vector indexes accelerate semantic similarity searches.
  • Understand the difference between exact and approximate nearest-neighbor searches.
  • Know that chunking improves retrieval quality for large documents.
  • Understand that multiple embeddings may exist for a single record.
  • Remember that embedding model upgrades usually require regenerating vectors.
  • Understand that relational filtering and vector search can be combined.
  • Expect scenario-based questions involving storage, indexing, scalability, and AI search architecture.

Practice Exam Questions


Question 1

A company is building a Retrieval-Augmented Generation (RAG) application using Azure SQL Database. They plan to store embeddings generated by the text-embedding-3-small model.

Which VECTOR data type should be used for the embedding column?

A. VECTOR(768)
B. VECTOR(1024)
C. VECTOR(1536)
D. VECTOR(3072)

Correct Answer: C

Explanation:
The text-embedding-3-small model generates 1,536-dimensional embeddings. The VECTOR column must match the number of dimensions produced by the embedding model. Using any other dimension would prevent embeddings from being stored correctly.


Question 2

A database contains 12 million product embeddings. Semantic searches are becoming increasingly slow because every query compares all vectors.

What should the database developer implement?

A. A clustered index on the VECTOR column
B. A vector index that supports Approximate Nearest Neighbor (ANN) searches
C. A nonclustered index on the product name
D. A filtered index on the category column

Correct Answer: B

Explanation:
Vector indexes using Approximate Nearest Neighbor algorithms dramatically reduce the number of comparisons required during similarity searches. Traditional SQL indexes cannot optimize vector similarity calculations.


Question 3

A developer must choose between a 768-dimensional embedding model and a 3,072-dimensional embedding model.

What is generally true about the larger embedding model?

A. It always performs searches faster.
B. It requires fewer storage resources.
C. It typically captures more semantic detail but requires additional storage and memory.
D. It cannot be indexed.

Correct Answer: C

Explanation:
Higher-dimensional embeddings generally preserve more semantic information, improving search quality. However, they increase storage requirements, memory consumption, and indexing costs.


Question 4

A database stores customer information together with vector embeddings representing customer support conversations.

Which design provides the greatest flexibility for regenerating embeddings after switching to a new embedding model?

A. Store embeddings in a separate table linked by the primary key.
B. Store embeddings inside a JSON document.
C. Store embeddings inside XML columns.
D. Store embeddings inside temporary tables.

Correct Answer: A

Explanation:
Separating embeddings into their own table simplifies regeneration, maintenance, versioning, and model migration while keeping business data unchanged.


Question 5

A development team wants to search only engineering documents while using semantic similarity.

Which approach best meets this requirement?

A. Perform only vector similarity searches across every document.
B. Filter documents by department using SQL, then perform vector similarity searches.
C. Disable relational filtering.
D. Store engineering documents in a separate SQL Server instance.

Correct Answer: B

Explanation:
One advantage of SQL databases is combining structured filtering with vector similarity search. Restricting the dataset before similarity comparisons improves both performance and relevance.


Question 6

A company stores embeddings for technical manuals that average 400 pages each.

What is the recommended design approach?

A. Generate one embedding for the entire manual.
B. Store only the title as an embedding.
C. Divide manuals into logical chunks and generate embeddings for each chunk.
D. Generate embeddings only for images.

Correct Answer: C

Explanation:
Chunking improves semantic retrieval accuracy by allowing searches to return only the most relevant portions of large documents rather than entire documents.


Question 7

A developer upgrades from one embedding model to another that produces vectors with a different number of dimensions.

What should the developer expect?

A. Existing vectors automatically resize.
B. Existing vectors remain compatible without changes.
C. SQL Server automatically converts vector dimensions.
D. Existing embeddings must be regenerated to match the new model dimensions.

Correct Answer: D

Explanation:
Embedding dimensions are fixed for each model. Changing models often changes vector size, requiring regeneration of all stored embeddings.


Question 8

An application contains approximately 3,000 embedded documents.

Which statement is most accurate regarding vector indexes?

A. Vector indexes are mandatory regardless of database size.
B. Vector indexes cannot be created until at least one million vectors exist.
C. A vector index may provide limited benefit for a very small dataset.
D. Vector indexes only work with GraphQL.

Correct Answer: C

Explanation:
Small datasets often perform adequately without vector indexes. The performance gains become much more significant as the number of vectors increases.


Question 9

A developer wants to support semantic search over product descriptions while maintaining product categories, prices, and inventory information in the same database.

Which database design best supports this objective?

A. Store embeddings in a VECTOR column while keeping relational attributes in standard SQL columns.
B. Store all relational data inside embedding vectors.
C. Replace relational tables with JSON files.
D. Store embeddings only in application memory.

Correct Answer: A

Explanation:
Keeping embeddings alongside relational data enables hybrid queries that combine SQL filtering with semantic similarity search, one of the major strengths of AI-enabled SQL databases.


Question 10

Which factor has the greatest impact on the storage requirements of vector data?

A. Database collation
B. Number of database users
C. Recovery model
D. Number of dimensions in each embedding

Correct Answer: D

Explanation:
Each embedding stores one numeric value per dimension. As the number of dimensions increases, the storage required for each vector grows proportionally, affecting table size, indexes, backups, and memory usage.


Final Exam Tips

  • Ensure the VECTOR column dimension exactly matches the embedding model.
  • Larger embeddings generally improve semantic quality but increase storage and computational costs.
  • Use vector indexes (ANN) for large datasets to improve search performance.
  • Combine relational SQL filtering with vector similarity searches for efficient hybrid queries.
  • Chunk large documents before generating embeddings to improve retrieval quality.
  • Store embedding model metadata and versions to simplify future migrations.
  • Separate embeddings from business data when frequent regeneration is expected.
  • Expect scenario-based questions comparing performance, storage, indexing strategies, and search architectures.

Go to the DP-800 Exam Prep Hub main page

Identify when to use vector-related types and functions for semantic searching, including VECTOR_NORMALIZE, VECTOR_DISTANCE, VECTORPROPERTY, and VECTOR_SEARCH (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement intelligent search
      --> Identify when to use vector-related types and functions for semantic searching, including VECTOR_NORMALIZE, VECTOR_DISTANCE, VECTORPROPERTY, and VECTOR_SEARCH


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Modern AI-powered database applications increasingly rely on semantic search, which retrieves information based on meaning rather than exact keyword matches. SQL Server 2025 (Preview), Azure SQL Database, and Azure SQL Managed Instance now include native vector capabilities, allowing developers to store embeddings and perform semantic searches directly inside the database.

Instead of exporting data to a separate vector database, developers can use built-in vector data types and functions to compare embeddings, calculate similarity, inspect vector metadata, normalize vectors, and perform efficient nearest-neighbor searches.

For the DP-800 certification exam, you should understand:

  • When semantic search is appropriate
  • The purpose of the VECTOR data type
  • How VECTOR_DISTANCE measures similarity
  • Why VECTOR_NORMALIZE is useful
  • How VECTORPROPERTY retrieves vector metadata
  • When to use VECTOR_SEARCH
  • Performance considerations
  • Common semantic search design patterns

Understanding Semantic Search

Traditional SQL searches compare exact values.

Example:

WHERE Description LIKE '%car%'

This search only returns rows containing the word car.

Semantic search instead compares meaning.

Searching for:

vehicle

may also return:

  • automobile
  • SUV
  • truck
  • sedan
  • crossover

because their embeddings are close together within vector space.


Native Vector Support in SQL

Microsoft SQL now supports vectors as first-class database objects.

Instead of storing embeddings externally, SQL databases can store:

  • relational columns
  • vector columns
  • AI metadata

inside one table.

Example:

ProductIDNameCategoryEmbedding
101LaptopElectronicsVECTOR(1536)

This enables SQL to perform both relational filtering and semantic similarity searches.


VECTOR Data Type

The VECTOR data type stores embedding values.

Example:

Embedding VECTOR(1536)

The dimension must exactly match the embedding model.

Examples:

  • VECTOR(768)
  • VECTOR(1024)
  • VECTOR(1536)
  • VECTOR(3072)

The VECTOR type is the foundation of all semantic search operations.


When to Use VECTOR_DISTANCE

VECTOR_DISTANCE measures how similar two vectors are.

Think of it as calculating the “distance” between meanings.

Smaller distance

More similar

Larger distance

Less similar

Example:

Customer query:

lightweight laptop

Document A

portable notebook computer

Very small distance

Document B

kitchen appliances

Very large distance


Common Uses of VECTOR_DISTANCE

Developers commonly use VECTOR_DISTANCE to:

  • Rank search results
  • Compare embeddings
  • Measure semantic similarity
  • Build recommendation engines
  • Find related documents
  • Identify duplicate content
  • Support AI assistants

Example Scenario

Suppose a user searches:

cloud database backup

SQL compares the query embedding against stored embeddings.

Each document receives a distance score.

Example:

DocumentDistance
Azure Backup Guide0.08
SQL Disaster Recovery0.13
Cloud Storage Overview0.19
Restaurant Menu0.92

The smallest distance represents the best semantic match.


Choosing a Distance Metric

Several similarity calculations exist.

Common metrics include:

  • Cosine similarity
  • Euclidean distance
  • Dot product

SQL vector functions abstract much of this complexity.

Developers simply request semantic similarity without implementing complex mathematics.


Why VECTOR_NORMALIZE Exists

Different vectors may have different magnitudes.

Normalization converts vectors into standardized lengths.

Instead of comparing:

Length + Direction

only

Direction

is compared.

This improves consistency.


When to Normalize Vectors

Normalization is commonly used when:

  • comparing embeddings from different sources
  • improving cosine similarity calculations
  • preprocessing vectors
  • preparing vectors before indexing

Many embedding models already generate normalized vectors.

Others do not.


Benefits of VECTOR_NORMALIZE

Normalization helps:

  • improve comparison consistency
  • reduce magnitude bias
  • improve semantic similarity scoring
  • produce more reliable nearest-neighbor searches

VECTORPROPERTY

VECTORPROPERTY retrieves metadata about vectors.

Rather than comparing vectors, it provides information about them.

Examples include:

  • dimension count
  • storage characteristics
  • metadata
  • vector properties

Developers often use VECTORPROPERTY for:

  • validation
  • diagnostics
  • troubleshooting
  • quality checks

Example Scenario

A developer receives embeddings from multiple AI models.

Some generate:

768 dimensions

Others generate:

1536 dimensions

Before inserting data, the developer verifies dimensions using VECTORPROPERTY.

This prevents invalid inserts.


VECTOR_SEARCH

VECTOR_SEARCH performs semantic nearest-neighbor searches.

Instead of writing complex similarity calculations manually, developers can search vectors directly.

Typical workflow:

User Question

Generate embedding

VECTOR_SEARCH

Most similar documents

Return results


When to Use VECTOR_SEARCH

VECTOR_SEARCH is ideal for:

  • Retrieval-Augmented Generation (RAG)
  • AI chatbots
  • document search
  • recommendation engines
  • semantic search portals
  • customer support systems
  • knowledge bases

VECTOR_SEARCH vs VECTOR_DISTANCE

Although related, they serve different purposes.

VECTOR_DISTANCE

  • compares two vectors

VECTOR_SEARCH

  • searches an entire collection

Think of it this way:

VECTOR_DISTANCE

Individual comparison

VECTOR_SEARCH

Database-wide search


Example Workflow

A user asks:

How do I configure Azure SQL backups?

Step 1

Generate query embedding.

Step 2

VECTOR_SEARCH finds similar documents.

Step 3

Top documents returned.

Step 4

LLM generates an answer.


Combining SQL Filtering with VECTOR_SEARCH

One advantage of SQL databases is hybrid querying.

Example:

Return only:

Category = Documentation

AND

perform semantic search.

This combines relational filtering with AI similarity.

Benefits include:

  • better accuracy
  • faster searches
  • improved relevance

Performance Considerations

Semantic search can become expensive.

Best practices include:

  • use vector indexes
  • normalize vectors when appropriate
  • filter relational data first
  • avoid unnecessarily large embeddings
  • use approximate nearest-neighbor indexes
  • limit returned results

Typical Semantic Search Architecture

Documents

Generate embeddings

Store vectors

Create vector index

User submits question

Generate query embedding

VECTOR_SEARCH

Nearest neighbors

LLM response


Choosing the Correct Function

FunctionPrimary Purpose
VECTORStores embeddings
VECTOR_DISTANCEMeasures similarity between two vectors
VECTOR_NORMALIZEStandardizes vectors before comparison
VECTORPROPERTYReturns vector metadata
VECTOR_SEARCHSearches collections for similar vectors

Best Practices

  • Store embeddings using the VECTOR data type.
  • Match VECTOR dimensions to the embedding model.
  • Use VECTOR_SEARCH for semantic retrieval.
  • Use VECTOR_DISTANCE for direct similarity comparisons.
  • Normalize vectors when required by the similarity metric.
  • Use VECTORPROPERTY to validate vector characteristics.
  • Combine relational filters with vector searches.
  • Create vector indexes for large datasets.
  • Store embedding model versions alongside vectors.
  • Monitor storage and indexing costs.

Common DP-800 Exam Tips

  • Understand when semantic search is preferable to keyword search.
  • Know the purpose of each vector function.
  • Understand that VECTOR_DISTANCE compares two vectors, while VECTOR_SEARCH searches an entire dataset.
  • Remember that VECTOR_NORMALIZE standardizes vectors before comparison.
  • Know that VECTORPROPERTY retrieves vector metadata rather than similarity scores.
  • Expect scenario-based questions requiring you to choose the correct vector function for a given task.
  • Understand how these functions support RAG, AI assistants, recommendation systems, and semantic search.

Practice Exam Questions


Question 1

A development team is building a Retrieval-Augmented Generation (RAG) application. They need to compare a user’s query embedding against thousands of stored document embeddings and return the most semantically similar documents.

Which SQL function is specifically designed for this purpose?

A. VECTOR_DISTANCE

B. VECTOR_SEARCH

C. VECTORPROPERTY

D. VECTOR_NORMALIZE

Correct Answer: B

Explanation:

VECTOR_SEARCH is designed to search an entire collection of stored vectors and return the nearest neighbors based on semantic similarity. VECTOR_DISTANCE compares only two vectors, VECTORPROPERTY returns metadata, and VECTOR_NORMALIZE standardizes vectors before comparison.


Question 2

An application receives embeddings from several AI models. Before storing them in SQL, developers want to verify that every embedding contains the expected number of dimensions.

Which function should they use?

A. VECTORPROPERTY

B. VECTOR_DISTANCE

C. VECTOR_SEARCH

D. VECTOR_NORMALIZE

Correct Answer: A

Explanation:

VECTORPROPERTY returns metadata about a vector, including characteristics such as its dimensions. This makes it ideal for validating vectors before they are stored.


Question 3

A developer needs to calculate how semantically similar two individual product descriptions are after generating embeddings for each.

Which function should be used?

A. VECTORPROPERTY

B. VECTOR_SEARCH

C. VECTOR_DISTANCE

D. VECTOR_NORMALIZE

Correct Answer: C

Explanation:

VECTOR_DISTANCE calculates the similarity or distance between two vectors. It is appropriate when directly comparing one embedding against another rather than searching an entire dataset.


Question 4

A machine learning engineer wants to eliminate differences caused by varying vector magnitudes before calculating cosine similarity.

Which function is most appropriate?

A. VECTORPROPERTY

B. VECTOR_SEARCH

C. VECTOR_DISTANCE

D. VECTOR_NORMALIZE

Correct Answer: D

Explanation:

VECTOR_NORMALIZE scales vectors to a consistent length while preserving their direction. This improves similarity calculations that rely on normalized vectors, particularly cosine similarity.


Question 5

A customer support chatbot first filters documentation to only include networking articles and then performs semantic retrieval over those documents.

What is the primary advantage of this approach?

A. It removes the need for embeddings.

B. It combines relational filtering with semantic search for improved relevance.

C. It converts keyword search into full-text search.

D. It prevents vector indexing.

Correct Answer: B

Explanation:

Filtering relational data before performing vector search reduces the search space and increases the relevance of returned results, improving both performance and accuracy.


Question 6

A SQL developer needs to rank five candidate documents according to how closely each one matches a user’s question.

Which function should be applied repeatedly against each candidate vector?

A. VECTOR_DISTANCE

B. VECTOR_SEARCH

C. VECTORPROPERTY

D. VECTOR_NORMALIZE

Correct Answer: A

Explanation:

VECTOR_DISTANCE computes similarity between two vectors. Developers can compare the query vector against multiple document vectors and rank the results by the smallest distance.


Question 7

Which scenario is the best use case for VECTOR_SEARCH?

A. Determining the number of dimensions stored within a vector

B. Standardizing vectors before storage

C. Finding the most similar documents across an entire knowledge base

D. Comparing only two vectors for similarity

Correct Answer: C

Explanation:

VECTOR_SEARCH is optimized for nearest-neighbor retrieval across an entire vector collection, making it ideal for semantic search applications such as RAG systems and AI assistants.


Question 8

An organization stores millions of embeddings inside Azure SQL Database.

Which action provides the greatest improvement in semantic search performance?

A. Increasing the embedding dimensions

B. Eliminating relational filtering

C. Replacing vectors with VARCHAR columns

D. Creating vector indexes

Correct Answer: D

Explanation:

Vector indexes significantly improve nearest-neighbor search performance over large datasets. Without indexing, vector searches become increasingly expensive as data volumes grow.


Question 9

A developer mistakenly uses VECTOR_SEARCH when they simply need to compare two embeddings generated during a unit test.

Which function would have been the more appropriate choice?

A. VECTORPROPERTY

B. VECTOR_DISTANCE

C. VECTOR_NORMALIZE

D. VECTOR_SEARCH

Correct Answer: B

Explanation:

VECTOR_DISTANCE compares two vectors directly. VECTOR_SEARCH is intended for searching an entire vector collection and would introduce unnecessary overhead for a simple comparison.


Question 10

Which statement best describes VECTORPROPERTY?

A. It calculates semantic similarity between vectors.

B. It searches vector indexes for nearest neighbors.

C. It retrieves metadata about stored vectors.

D. It converts text into embeddings.

Correct Answer: C

Explanation:

VECTORPROPERTY returns information about vectors, such as their dimensions or other characteristics. It does not calculate similarity, generate embeddings, or perform semantic searches.


DP-800 Exam Tips

  • Know the distinction between VECTOR_DISTANCE (two-vector comparison) and VECTOR_SEARCH (collection-wide nearest-neighbor search).
  • Use VECTORPROPERTY to inspect or validate vector metadata before processing.
  • Apply VECTOR_NORMALIZE when your similarity metric or embedding workflow benefits from normalized vectors.
  • Combine relational filtering with semantic search to improve performance and relevance.
  • Create vector indexes for large datasets to optimize semantic search operations.
  • Expect scenario-based exam questions that require selecting the appropriate vector function based on a real-world AI application, such as RAG, semantic search, recommendation systems, or AI chatbots.

Go to the DP-800 Exam Prep Hub main page

Choose between using ANN and ENN for vector search (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement intelligent search
      --> Choose between using ANN and ENN for vector search


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Vector search is the foundation of modern AI-powered applications such as Retrieval-Augmented Generation (RAG), semantic search, recommendation engines, document similarity, and intelligent assistants. As vector databases grow from thousands to millions of embeddings, selecting the appropriate search algorithm becomes increasingly important.

One of the most important architectural decisions is choosing between:

  • Approximate Nearest Neighbor (ANN) search
  • Exact Nearest Neighbor (ENN) search

Although both methods retrieve vectors that are similar to a query vector, they differ significantly in performance, scalability, accuracy, resource usage, and appropriate use cases.

For the DP-800 exam, candidates should understand when to use ANN versus ENN, how vector indexes influence each approach, and the trade-offs involved in balancing search speed with search accuracy.


Understanding Nearest Neighbor Search

Once embeddings have been generated for documents, products, images, or other data, a user query is also converted into an embedding.

The search engine must identify the vectors that are “closest” to the query vector.

Closeness is typically measured using:

  • Cosine similarity
  • Euclidean distance (L2)
  • Dot product

The challenge becomes finding the nearest vectors efficiently.

If a database contains:

  • 5,000 vectors
  • 500,000 vectors
  • 50 million vectors

the search strategy dramatically affects response time.


Exact Nearest Neighbor (ENN)

Exact Nearest Neighbor performs an exhaustive comparison.

Every stored vector is compared against the query vector.

The system computes the distance to every record before returning the closest matches.

Characteristics

  • Searches every vector
  • Produces mathematically exact results
  • No approximation
  • Highest accuracy
  • Computationally expensive
  • Slower as data grows

ENN Workflow

Query Vector
Compare against Vector 1
Compare against Vector 2
Compare against Vector 3
...
Compare against Vector N
Sort by similarity
Return Top K

Advantages of ENN

Maximum Accuracy

Every possible vector is evaluated.

No relevant documents are skipped.


Deterministic Results

The same query always produces the same ranking.


No Index Approximation

Results represent the actual nearest neighbors.


Simpler Conceptually

The algorithm is straightforward.

No graph traversal or approximation heuristics are involved.


Disadvantages of ENN

Poor Scalability

Performance decreases linearly with dataset size.

Examples:

  • 1,000 vectors → very fast
  • 100,000 vectors → acceptable
  • 10 million vectors → slow
  • 100 million vectors → often impractical

High CPU Usage

Every query compares against every stored embedding.


Higher Latency

Search time increases as the vector collection grows.


Common ENN Use Cases

ENN is appropriate when:

  • Maximum precision is required
  • Dataset is relatively small
  • Scientific applications require exact matches
  • Benchmarking ANN algorithms
  • Testing search quality
  • Evaluation environments

Examples include:

  • Medical research
  • Financial analytics
  • Legal document comparison
  • Academic datasets
  • Quality assurance testing

Approximate Nearest Neighbor (ANN)

Approximate Nearest Neighbor avoids comparing every vector.

Instead, it uses specialized vector indexes that intelligently narrow the search space.

The goal is to find vectors that are almost certainly among the nearest neighbors while dramatically improving search speed.

ANN typically achieves:

  • 95–99.9% recall
  • Much lower latency
  • Massive scalability

ANN Workflow

Query Vector
Search Vector Index
Explore Nearby Candidates
Evaluate Candidate Vectors
Return Top K

Instead of examining millions of vectors, ANN may evaluate only a few hundred or a few thousand candidate vectors.


Advantages of ANN

Extremely Fast

ANN dramatically reduces search time.

Milliseconds instead of seconds.


Highly Scalable

Suitable for:

  • Millions of vectors
  • Tens of millions
  • Hundreds of millions
  • Billions of vectors

Lower Compute Costs

Fewer distance calculations are required.


Excellent User Experience

Ideal for interactive AI applications requiring real-time responses.


Production Ready

Nearly every modern AI search engine uses ANN.

Examples include:

  • Azure AI Search
  • Azure SQL vector indexes
  • Azure Cosmos DB vector search
  • Pinecone
  • Milvus
  • Weaviate
  • Qdrant
  • FAISS
  • pgvector with ANN indexes

Disadvantages of ANN

Results Are Approximate

Occasionally, the true nearest neighbor may not be returned.

Instead, the algorithm returns vectors that are extremely close.


Slight Reduction in Recall

Typical recall values:

  • 95%
  • 98%
  • 99%

depending on index configuration.


Index Maintenance

ANN requires building and maintaining vector indexes.


Additional Memory Usage

Indexes consume additional storage.


ANN vs ENN Comparison

FeatureENNANN
Accuracy100%Nearly 100%
SpeedSlowerMuch faster
ScalabilityPoorExcellent
Uses Vector IndexNoYes
CPU UsageHighLower
Memory UsageLowerHigher
Best for Small DataYesSometimes
Best for Large DataNoYes
Typical Production ChoiceRareVery Common

Why ANN Is Usually Preferred

Most enterprise AI applications prioritize:

  • Fast responses
  • Interactive user experiences
  • Large knowledge bases
  • Millions of documents

Waiting several seconds for every search is unacceptable.

Therefore, ANN has become the industry standard for production semantic search.

For example:

A chatbot searching:

  • 8 million support articles

cannot realistically compare every embedding.

Instead, ANN rapidly narrows the candidate set before computing exact similarity among only the most promising vectors.


Recall vs Accuracy

One of the most important concepts is recall.

Recall measures how many of the true nearest neighbors are successfully returned.

Example:

Suppose the true Top 10 neighbors are:

A
B
C
D
E
F
G
H
I
J

An ANN search returns:

A
B
C
D
E
F
G
H
I
K

Recall is:

9 / 10 = 90%

Although one neighbor is missing, the results are still highly useful for most AI applications.

Many ANN algorithms achieve recall rates above 99%.


Popular ANN Algorithms

Several indexing algorithms support ANN search.

Common examples include:

HNSW (Hierarchical Navigable Small World)

Most common modern ANN algorithm.

Advantages:

  • Very fast
  • Excellent recall
  • High-quality results
  • Widely used

IVF (Inverted File Index)

Partitions vectors into clusters.

Search examines only relevant clusters.

Good for extremely large datasets.


DiskANN

Optimized for very large vector collections stored partly on disk.

Designed for cloud-scale systems.


Product Quantization (PQ)

Compresses vectors to reduce memory usage.

Often combined with IVF.


Choosing Between ANN and ENN

Choose ENN When

  • Dataset is small
  • Exact results are mandatory
  • Benchmarking search quality
  • Scientific analysis
  • Compliance requires deterministic behavior
  • Testing vector models

Choose ANN When

  • Dataset contains millions of vectors
  • Response time matters
  • Building chatbots
  • Implementing RAG
  • Semantic document search
  • Recommendation systems
  • AI copilots
  • Enterprise knowledge bases

ANN in Azure SQL

Azure SQL’s vector search capabilities are designed to support scalable semantic search workloads.

When vector indexes are implemented, Azure SQL can perform ANN searches efficiently, making it practical to query very large embedding collections while maintaining excellent recall.

This enables AI-powered applications to combine:

  • Relational filtering
  • Vector similarity
  • SQL queries
  • AI inference

within a single database platform.


ANN and Hybrid Search

Many production applications combine ANN with traditional filtering.

Example:

A company stores:

  • 20 million product embeddings

A customer searches:

“Wireless ergonomic keyboard”

The query first filters:

Category = Electronics
Brand = Microsoft
Price < $150

Then ANN searches only the filtered candidate vectors.

This combination improves:

  • Speed
  • Relevance
  • Scalability

DP-800 Exam Tips

  • Understand that ENN performs exhaustive comparisons, while ANN uses vector indexes to accelerate nearest-neighbor retrieval.
  • Remember that ANN trades a small amount of accuracy for significant gains in performance and scalability, making it the preferred option for production AI systems.
  • Be familiar with HNSW, IVF, and other ANN indexing techniques at a conceptual level.
  • Know that ENN is appropriate for small datasets, benchmarking, and scenarios requiring mathematically exact results.
  • Expect scenario-based questions asking which approach is best based on dataset size, latency requirements, scalability, and accuracy expectations.
  • Recognize that ANN is the default choice for RAG systems, semantic search, recommendation engines, AI assistants, and enterprise knowledge bases containing millions of embeddings.

Practice Exam Questions


Question 1

A company has built a Retrieval-Augmented Generation (RAG) solution that searches through 50 million document embeddings. Users expect responses within two seconds. Which vector search approach is the most appropriate?

A. Exact Nearest Neighbor (ENN) because it guarantees mathematically exact results for every query

B. Approximate Nearest Neighbor (ANN) because it provides low-latency searches while maintaining high recall

C. Sequential table scans because they avoid maintaining vector indexes

D. Full-text search because embeddings are not required for semantic search

Correct Answer: B

Explanation: ANN is specifically designed for large-scale vector datasets where fast response times are essential. It dramatically reduces search latency while maintaining very high recall, making it ideal for production RAG systems.


Question 2

A research laboratory is validating a new embedding model and requires every query to return the mathematically closest vectors with no approximation. Which search method should be used?

A. Hybrid search

B. Hierarchical Navigable Small World (HNSW)

C. Exact Nearest Neighbor (ENN)

D. Approximate Nearest Neighbor (ANN)

Correct Answer: C

Explanation: ENN compares the query vector against every stored vector, guaranteeing exact nearest-neighbor results. This makes it appropriate for benchmarking, scientific validation, and testing.


Question 3

What is the primary advantage of Approximate Nearest Neighbor (ANN) search over Exact Nearest Neighbor (ENN) search?

A. ANN always returns more accurate results.

B. ANN eliminates the need for vector embeddings.

C. ANN significantly improves search performance and scalability by reducing the number of vectors evaluated.

D. ANN only works with relational databases.

Correct Answer: C

Explanation: ANN achieves much faster searches by using specialized vector indexes to evaluate only the most promising candidate vectors instead of comparing every vector.


Question 4

A database contains approximately 2,500 embeddings used by a legal review application where accuracy is more important than response time. Which search strategy is most appropriate?

A. Approximate Nearest Neighbor (ANN)

B. Hybrid search

C. Semantic ranking

D. Exact Nearest Neighbor (ENN)

Correct Answer: D

Explanation: With a relatively small dataset and strict accuracy requirements, ENN is preferred because it guarantees exact nearest-neighbor results.


Question 5

Which statement best describes the concept of recall in Approximate Nearest Neighbor search?

A. It measures how quickly a query completes.

B. It measures the percentage of true nearest neighbors successfully returned.

C. It measures the amount of memory consumed by the vector index.

D. It measures the total number of vectors stored.

Correct Answer: B

Explanation: Recall measures how many of the actual nearest neighbors are retrieved by the ANN algorithm. Higher recall indicates results that more closely match those of an exact search.


Question 6

Which indexing algorithm is most commonly associated with modern ANN implementations due to its excellent balance of speed and recall?

A. HNSW (Hierarchical Navigable Small World)

B. B-tree

C. Hash index

D. Clustered columnstore index

Correct Answer: A

Explanation: HNSW is one of the most widely used ANN algorithms because it provides fast searches with excellent recall for large vector datasets.


Question 7

A development team notices that vector search performance decreases as the database grows from thousands to tens of millions of embeddings. Which architectural change is most likely to improve scalability?

A. Replace vector embeddings with keyword indexes.

B. Use ENN for every query.

C. Disable vector indexes.

D. Implement ANN with an appropriate vector index.

Correct Answer: D

Explanation: ANN combined with vector indexes is specifically designed to scale efficiently to millions or even billions of embeddings while maintaining acceptable accuracy.


Question 8

Which characteristic is typically associated with Exact Nearest Neighbor (ENN) search?

A. Uses approximation techniques to improve performance.

B. Compares only a subset of candidate vectors.

C. Performs exhaustive comparisons against every stored vector.

D. Requires HNSW indexing.

Correct Answer: C

Explanation: ENN performs a complete comparison against all stored vectors, ensuring mathematically exact results but requiring significantly more computation.


Question 9

An AI-powered product recommendation system serves millions of users each day. The recommendation engine must respond in milliseconds while maintaining highly relevant results. Which approach best meets these requirements?

A. Exact Nearest Neighbor (ENN)

B. Sequential vector scans

C. ANN using vector indexes

D. Full-table scans followed by sorting

Correct Answer: C

Explanation: ANN is optimized for production AI workloads that require low latency and high scalability while maintaining high-quality semantic search results.


Question 10

Which statement best summarizes the trade-off between ANN and ENN?

A. ENN sacrifices accuracy for better scalability.

B. ANN always returns identical results to ENN.

C. ENN requires vector indexes while ANN does not.

D. ANN slightly reduces accuracy in exchange for dramatically improved search performance and scalability.

Correct Answer: D

Explanation: The primary trade-off is that ANN accepts a small reduction in accuracy (typically maintaining 95–99%+ recall) to achieve significantly faster query performance and support very large datasets.


Go to the DP-800 Exam Prep Hub main page

Evaluate vector index types and metrics (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement intelligent search
      --> Evaluate vector index types and metrics


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Understanding vector indexes and similarity metrics is essential when building AI-enabled database applications that perform semantic search, retrieval-augmented generation (RAG), recommendation engines, and AI-powered document retrieval. Selecting the correct vector index type and similarity metric has a major impact on search accuracy, scalability, latency, and infrastructure costs.

Traditional database indexes are designed to efficiently locate exact values or values within a range.

Examples include:

  • Primary key indexes
  • Clustered indexes
  • Nonclustered indexes
  • Full-text indexes

These indexes perform extremely well for queries such as:

WHERE CustomerID = 123

or

WHERE LastName LIKE 'Smith%'

However, AI applications frequently need to answer questions based on meaning rather than exact text.

For example:

User query:

“Hotels close to the beach with great seafood.”

Documents may contain:

“Oceanfront resort featuring fresh local cuisine.”

There are no matching keywords, yet both sentences describe the same concept.

This is where vector search becomes essential.


What Is a Vector?

A vector is a numerical representation of text, images, audio, or other data generated by an embedding model.

Instead of storing text as characters, AI models convert information into hundreds or thousands of numeric dimensions.

Example:

"The cat sat on the mat."
[0.183,
-0.442,
0.913,
...
1536 dimensions]

Documents discussing similar concepts produce vectors that are mathematically close together.


Why Vector Indexes Are Needed

Suppose a database contains 10 million document embeddings.

Without an index:

  • every query compares against every vector
  • search complexity becomes enormous
  • latency may reach several seconds

Vector indexes organize vectors to reduce the number of comparisons dramatically while preserving high search quality.


Exact vs Approximate Search

Vector search generally falls into two categories.

Exact Search

Also known as:

  • Brute-force search
  • Exhaustive search

Process:

  1. Compare query vector to every stored vector.
  2. Calculate similarity score.
  3. Sort results.
  4. Return best matches.

Advantages:

  • 100% accurate
  • Always finds nearest neighbor
  • Simple implementation

Disadvantages:

  • Slow
  • Poor scalability
  • High CPU usage

Best for:

  • Small datasets
  • Testing
  • Benchmarking

Approximate Nearest Neighbor (ANN)

ANN algorithms search intelligently instead of comparing every vector.

Advantages:

  • Extremely fast
  • Scales to millions or billions of vectors
  • Lower resource consumption

Tradeoff:

  • Results are extremely close to optimal but not always mathematically perfect.

Most enterprise AI systems use ANN indexes.


Common Vector Index Types

1. Flat Index (Brute Force)

Every vector is scanned.

Query
Compare with Vector 1
Compare with Vector 2
Compare with Vector 3
...
Best Match

Advantages

  • Perfect accuracy
  • No preprocessing
  • Easy to maintain

Disadvantages

  • Slow
  • Doesn’t scale well

Best for

  • Small datasets
  • Testing

2. HNSW (Hierarchical Navigable Small World)

One of the most popular ANN indexes.

Rather than checking every vector, HNSW creates multiple graph layers.

High-level layers:

A
B
C

Lower layers:

A — D — E — F
\ |
G — H

The search begins at higher levels and progressively narrows the search.

Advantages

  • Extremely high recall
  • Very low latency
  • Excellent scalability

Disadvantages

  • More memory required
  • Longer index creation time

Commonly used in:

  • Azure SQL vector search
  • AI search engines
  • Modern vector databases

3. IVF (Inverted File Index)

Vectors are grouped into clusters.

Cluster A
Cluster B
Cluster C
Cluster D

Instead of searching every cluster:

  1. Identify closest cluster.
  2. Search only that cluster.

Advantages

  • Very fast
  • Efficient memory usage

Disadvantages

  • Search quality depends on clustering accuracy.

4. Product Quantization (PQ)

PQ compresses vectors into compact representations.

Instead of storing:

1536 floating-point numbers

it stores compressed codes.

Advantages

  • Huge storage savings
  • Faster searches
  • Lower memory usage

Disadvantages

  • Slight loss of precision

Often combined with IVF.


5. Disk-Based Indexes

Some systems keep indexes primarily on disk instead of RAM.

Advantages

  • Supports enormous datasets

Disadvantages

  • Higher latency

Useful when memory is limited.


Comparing Index Types

IndexAccuracySpeedMemoryTypical Use
FlatHighestSlowMediumSmall datasets
HNSWVery HighVery FastHighEnterprise RAG
IVFHighFastMediumLarge datasets
IVF + PQModerate-HighVery FastLowMassive collections
Disk-basedHighModerateLow RAMVery large databases

Understanding Similarity Metrics

A vector index determines how vectors are organized.

A similarity metric determines how closeness is measured.

Choosing the wrong metric can significantly reduce search quality.


Cosine Similarity

The most widely used similarity metric.

Measures the angle between vectors.

Formula (conceptually):

Similarity = cos(angle)

Identical direction:

1.0

Perpendicular:

0

Opposite direction:

-1

Advantages

  • Ignores vector magnitude
  • Excellent for semantic search
  • Very common in embedding models

Typical uses

  • Document search
  • Chatbots
  • RAG
  • Azure OpenAI embeddings

Euclidean Distance

Measures straight-line distance.

Distance = √((x₂−x₁)²...)

Smaller distance means greater similarity.

Advantages

  • Easy to understand
  • Works well for spatial data

Disadvantages

  • Sensitive to vector magnitude

Dot Product

Calculates the mathematical product of vectors.

Useful when embedding magnitude carries meaning.

Often used by recommendation systems.

Advantages

  • Computationally efficient
  • Good with normalized embeddings

Manhattan Distance

Also called:

L1 distance

Measures movement along axes.

|x1-x2| + |y1-y2|

Less common in vector databases.


Hamming Distance

Used for binary vectors.

Measures the number of differing bits.

Common in binary embeddings.


Choosing the Right Similarity Metric

MetricBest For
Cosine SimilaritySemantic search
Euclidean DistanceSpatial similarity
Dot ProductRecommendation systems
Manhattan DistanceGrid-based comparisons
Hamming DistanceBinary vectors

Matching Metrics to Embedding Models

Many embedding models are trained assuming a particular similarity metric.

Examples:

  • OpenAI embeddings → Cosine similarity
  • Azure OpenAI embeddings → Cosine similarity
  • Sentence Transformer models → Cosine similarity (commonly)
  • Some recommendation models → Dot product

Using the incorrect metric can reduce retrieval quality.


Tradeoffs When Evaluating Vector Indexes

Database developers evaluate multiple characteristics.

Search Accuracy

Higher recall produces better retrieval quality.

Higher accuracy often requires:

  • more memory
  • more CPU
  • larger indexes

Query Latency

AI chat applications typically require responses within milliseconds.

Approximate indexes dramatically reduce latency.


Recall

Recall measures how many true nearest neighbors are returned.

Example:

Actual nearest neighbors:

A
B
C
D
E

Returned:

A
B
C
X
Y

Recall:

3/5 = 60%

Higher recall improves RAG quality.


Memory Usage

HNSW indexes often consume substantial memory.

Compressed indexes require much less.


Build Time

Some indexes build quickly.

Others may require extensive preprocessing.

Large enterprise indexes may take hours to create.


Update Performance

Questions to evaluate:

  • How quickly can vectors be inserted?
  • Can vectors be deleted efficiently?
  • Is index rebuilding required?

Applications with frequent updates may favor indexes that support incremental maintenance.


Vector Index Selection Guidelines

Small Collections (<100K vectors)

Recommended:

  • Flat index

Reason:

  • Simplicity
  • Maximum accuracy

Medium Collections (100K–10M)

Recommended:

  • HNSW

Reason:

  • Excellent speed
  • Excellent recall

Massive Collections (100M+)

Recommended:

  • IVF
  • IVF + PQ

Reason:

  • Reduced storage
  • Excellent scalability

Memory-Constrained Systems

Recommended:

  • Product Quantization
  • Disk-based indexes

Vector Indexes in SQL-Based AI Solutions

Modern SQL platforms increasingly support vector capabilities.

Examples include:

  • SQL databases with vector data types
  • Vector indexes
  • Embedding storage
  • Similarity search functions

These capabilities enable developers to combine structured SQL queries with semantic AI search within a single database solution.


Best Practices

  • Match the similarity metric to the embedding model.
  • Use cosine similarity for most semantic search workloads.
  • Prefer ANN indexes for production systems.
  • Benchmark recall, latency, and throughput before deployment.
  • Monitor index performance as datasets grow.
  • Rebuild or optimize indexes when fragmentation or large-scale updates reduce efficiency.
  • Evaluate memory consumption alongside query performance.
  • Test retrieval quality using realistic user queries.

DP-800 Exam Tips

Remember these key points for the exam:

  • Vector indexes optimize similarity search rather than exact matching.
  • ANN indexes trade a small amount of accuracy for significant performance gains.
  • HNSW is a leading ANN algorithm due to its high recall and low latency.
  • IVF clusters vectors before searching.
  • Product Quantization reduces storage requirements.
  • Cosine similarity is the preferred metric for most semantic search scenarios.
  • Choosing the appropriate similarity metric is just as important as choosing the index type.
  • Retrieval quality depends on embeddings, similarity metrics, and index configuration working together.

Practice Exam Questions

Question 1

A development team is building a Retrieval-Augmented Generation (RAG) solution containing over 15 million document embeddings. The application requires low query latency while maintaining high retrieval accuracy.

Which vector index type is the most appropriate?

A. Flat index

B. HNSW

C. Clustered index

D. Full-text index

Answer: B

Explanation:
HNSW is designed for Approximate Nearest Neighbor (ANN) search and offers excellent recall with very low latency, making it a common choice for large-scale RAG implementations. Flat indexes become too slow at this scale, while clustered and full-text indexes are not vector indexes.


Question 2

Which similarity metric is most commonly used with modern text embedding models for semantic search?

A. Manhattan Distance

B. Euclidean Distance

C. Cosine Similarity

D. Hamming Distance

Answer: C

Explanation:
Cosine similarity compares the angle between vectors rather than their magnitude, making it ideal for semantic search. Many embedding models, including Azure OpenAI embeddings, are designed to work effectively with cosine similarity.


Question 3

A database developer wants mathematically perfect nearest-neighbor results regardless of execution time.

Which search method should be selected?

A. Approximate Nearest Neighbor

B. Product Quantization

C. Exhaustive (Flat) Search

D. IVF

Answer: C

Explanation:
Exhaustive or flat search compares the query against every stored vector, guaranteeing the exact nearest neighbors. This approach is computationally expensive but provides maximum accuracy.


Question 4

What is the primary purpose of Product Quantization (PQ)?

A. Improve SQL joins

B. Increase transaction throughput

C. Normalize embeddings

D. Reduce storage and memory requirements

Answer: D

Explanation:
Product Quantization compresses vectors into compact representations, reducing storage and memory usage while enabling efficient searches. The tradeoff is a small reduction in precision.


Question 5

Which statement best describes Approximate Nearest Neighbor (ANN) indexing?

A. It guarantees perfect search accuracy.

B. It searches every vector sequentially.

C. It balances retrieval accuracy with search performance.

D. It only supports binary vectors.

Answer: C

Explanation:
ANN algorithms reduce search time by avoiding exhaustive comparisons. They provide high-quality results with much better performance than exact search, making them suitable for production AI systems.


Question 6

A team notices that their semantic search results have degraded after switching from cosine similarity to Euclidean distance while using the same embedding model.

What is the most likely cause?

A. The embedding model was trained assuming cosine similarity.

B. Euclidean distance always produces identical results.

C. Vector indexes require clustered tables.

D. SQL Server does not support vectors.

Answer: A

Explanation:
Embedding models are often optimized for specific similarity metrics. Using a different metric than the one assumed during training can reduce retrieval quality even if the vectors themselves remain unchanged.


Question 7

Why do vector indexes improve search performance?

A. They reduce the dimensionality of every embedding.

B. They organize vectors so fewer comparisons are needed.

C. They convert vectors into relational tables.

D. They eliminate the need for embeddings.

Answer: B

Explanation:
Vector indexes structure embeddings so that searches examine only promising candidates instead of every stored vector, significantly reducing query latency.


Question 8

A company has a small proof-of-concept application containing 25,000 document embeddings. Search accuracy is more important than performance.

Which index is the best choice?

A. IVF + PQ

B. HNSW

C. Flat index

D. Disk-based ANN index

Answer: C

Explanation:
For relatively small datasets where absolute accuracy is the priority, a flat index is often the simplest and most accurate solution. Performance remains acceptable because the collection size is limited.


Question 9

Which evaluation metric indicates how many true nearest neighbors are successfully returned during a vector search?

A. Latency

B. Precision

C. Throughput

D. Recall

Answer: D

Explanation:
Recall measures the proportion of actual nearest neighbors that are retrieved by the search algorithm. Higher recall generally leads to better retrieval quality in semantic search and RAG systems.


Question 10

When evaluating different vector index types for a production AI solution, which combination of factors is most important?

A. File size and backup frequency

B. Number of SQL tables and views

C. Search latency, recall, memory usage, and index maintenance

D. Number of stored procedures and triggers

Answer: C

Explanation:
Production vector indexes should be evaluated based on their ability to deliver fast queries, high recall, efficient memory utilization, and manageable maintenance as data volumes grow. These characteristics directly affect the performance and scalability of AI-enabled database solutions.


Go to the DP-800 Exam Prep Hub main page

Implement vector search (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement intelligent search
      --> Implement vector search


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Implementing vector search is one of the foundational skills for building modern AI-enabled database applications. Vector search enables databases to retrieve information based on semantic meaning rather than exact keyword matches, making it essential for Retrieval-Augmented Generation (RAG), AI assistants, recommendation engines, semantic document search, knowledge management systems, and intelligent enterprise applications.


What Is Vector Search?

Traditional SQL queries search for exact values.

For example:

SELECT *
FROM Products
WHERE ProductName = 'Laptop';

or

WHERE Description LIKE '%wireless%'

These approaches rely on exact text matching.

However, AI applications often need to answer questions like:

“Find documents about reducing cloud costs.”

Relevant documents might contain:

  • Lower Azure spending
  • Optimize infrastructure expenses
  • Cloud cost optimization
  • Reduce operational costs

Although these documents contain different words, they share the same meaning.

Vector search enables databases to find these semantically related documents.


How Vector Search Works

Vector search consists of several stages.

User Query
Embedding Model
Query Vector
Vector Similarity Search
Nearest Neighbor Documents
(Optional)
Large Language Model (LLM)

Instead of comparing text directly, the database compares numeric vector representations generated by an embedding model.


What Is a Vector?

A vector is a high-dimensional numerical representation of data.

Example:

"Azure SQL Database"
[-0.134,
0.281,
0.998,
...
1536 dimensions]

Every document stored in the database has its own embedding vector.

When a user submits a query, the query is also converted into a vector.

The database then compares vectors mathematically to identify the most similar results.


Components of a Vector Search Solution

A complete vector search implementation includes several components.

1. Source Data

Examples include:

  • PDF files
  • Product catalogs
  • Emails
  • Knowledge articles
  • Web pages
  • Support tickets
  • SQL records

2. Embedding Model

The embedding model converts text into vectors.

Popular examples include:

  • Azure OpenAI Embeddings
  • OpenAI text embedding models
  • Sentence Transformers
  • Other compatible embedding models

The embedding model should remain consistent for both indexing and querying.


3. Vector Storage

Embeddings are stored inside the database.

Example table:

DocumentIDContentEmbedding
101Product Manual[1536 values]
102FAQ[1536 values]
103Warranty Guide[1536 values]

Modern SQL databases increasingly support dedicated vector data types.


4. Vector Index

Searching millions of vectors without an index would require comparing every vector.

Vector indexes organize embeddings for efficient similarity searches.

Common vector indexes include:

  • Flat (Exact Search)
  • HNSW
  • IVF
  • IVF + Product Quantization (PQ)

Approximate Nearest Neighbor (ANN) indexes are commonly used in production systems because they significantly reduce search latency while maintaining high recall.


5. Similarity Function

The database determines which vectors are closest.

Common similarity metrics include:

  • Cosine similarity
  • Euclidean distance
  • Dot product

Cosine similarity is the most common metric for semantic search.


Exact Search vs Approximate Search

Exact (Brute Force) Search

The database compares the query vector against every stored vector.

Advantages:

  • Perfect accuracy
  • Guaranteed nearest neighbors

Disadvantages:

  • Slow
  • Poor scalability

Best suited for:

  • Small datasets
  • Testing
  • Validation

Approximate Nearest Neighbor (ANN)

ANN indexes intelligently reduce the search space.

Advantages:

  • Extremely fast
  • Scales to millions or billions of vectors
  • Lower CPU utilization

Tradeoff:

Results are highly accurate but not mathematically perfect.

Most enterprise AI applications use ANN search.


Implementing Vector Search

A typical implementation follows these steps.

Step 1. Prepare Data

Collect the documents.

Examples:

  • Product manuals
  • Policies
  • Emails
  • Support articles

Clean the text by removing unnecessary formatting and duplicate content.


Step 2. Generate Embeddings

Use an embedding model to create vectors.

Example workflow:

Document
Embedding Model
1536-Dimensional Vector

Each document receives one or more embeddings.


Step 3. Store Embeddings

Store:

  • Original text
  • Metadata
  • Embedding vector

Example:

DocumentIDCategoryContentEmbedding
501HRVacation PolicyVector
502ITVPN SetupVector

Metadata enables additional filtering during searches.


Step 4. Create a Vector Index

The vector index accelerates similarity searches.

Without an index:

Query
Compare to every vector

With an ANN index:

Query
Index
Small candidate set
Best matches

Step 5. Convert User Query

The user’s search query is embedded using the same embedding model.

Example:

"How do I connect remotely?"
Embedding Model
Query Vector

Consistency is critical. Using a different embedding model for queries than for indexed documents can significantly reduce search quality.


Step 6. Perform Similarity Search

The database compares the query vector with stored vectors.

Example SQL pseudocode:

SELECT TOP 5
DocumentID,
SimilarityScore
FROM Documents
ORDER BY VECTOR_DISTANCE(Embedding, @QueryVector);

The exact syntax varies depending on the database platform and vector search implementation.


Step 7. Return Results

The application retrieves the closest documents.

Example:

RankDocument
1VPN Configuration Guide
2Remote Access FAQ
3Employee Network Policy

Vector Search Workflow

Documents
Generate Embeddings
Store Vectors
Create Vector Index
User Query
Generate Query Embedding
Similarity Search
Top Matching Documents

Filtering Vector Search Results

Many applications combine vector search with traditional SQL filtering.

Example:

Semantic Search
+
WHERE Department = 'Finance'
+
ORDER BY Similarity

This approach is often called hybrid filtering, allowing organizations to limit searches by structured metadata while still leveraging semantic similarity.

Examples of filters include:

  • Department
  • Date
  • Customer
  • Region
  • Security classification
  • Language

Hybrid Search

Hybrid search combines:

  • Keyword search
  • Full-text search
  • Vector search

Example:

Keyword Search
+
Vector Search
Combined Ranking
Final Results

Benefits include:

  • Higher relevance
  • Better handling of synonyms
  • Stronger ranking
  • Improved user satisfaction

Many enterprise AI search systems use hybrid search instead of vector search alone.


Using Vector Search in RAG

Retrieval-Augmented Generation relies heavily on vector search.

Workflow:

User Question
Embedding
Vector Search
Relevant Documents
LLM
Grounded Response

Instead of relying solely on the LLM’s training data, the model uses retrieved documents as grounding data.

Benefits:

  • More accurate responses
  • Reduced hallucinations
  • Access to current organizational knowledge

Common Vector Search Scenarios

Enterprise Knowledge Search

Users ask natural language questions.

Example:

“How do I reset my VPN password?”

The database retrieves the most semantically relevant documentation.


Customer Support

Support engineers search:

“Printer won’t connect.”

Relevant troubleshooting documents are retrieved even if they use different wording.


Product Recommendation

Customers searching for:

“Comfortable running shoes”

may receive products described as:

  • Lightweight trainers
  • Cushioned athletic footwear
  • Marathon shoes

Legal Document Search

Law firms search by legal concepts rather than exact wording.


Healthcare Knowledge Bases

Clinicians retrieve similar cases based on symptoms rather than identical terminology.


Performance Considerations

Database developers should evaluate:

Search Latency

Users expect responses within milliseconds.

ANN indexes dramatically reduce latency.


Recall

Recall measures how many of the true nearest neighbors are returned.

Higher recall generally improves RAG quality.


Index Size

Larger indexes often improve retrieval quality but require more memory.


Memory Consumption

HNSW indexes typically consume more RAM than compressed indexes.


Index Build Time

Large vector indexes may require significant time to build.

Plan for maintenance windows when rebuilding indexes.


Update Frequency

Applications with frequent inserts and deletes should use index types that efficiently support incremental updates.


Common Implementation Mistakes

Using Different Embedding Models

Documents embedded with one model should not be searched using vectors generated by a different model.


Using the Wrong Similarity Metric

Many embedding models assume cosine similarity.

Using Euclidean distance or dot product incorrectly may reduce search accuracy.


Not Creating a Vector Index

Searching without an index performs poorly on large datasets.


Ignoring Metadata

Metadata filtering significantly improves result quality.


Returning Too Many Documents

Retrieving excessive documents increases latency and may overwhelm downstream LLMs in RAG systems.


Best Practices

  • Use the same embedding model for indexing and querying.
  • Choose a similarity metric recommended for the embedding model.
  • Use ANN indexes for production environments.
  • Combine vector search with metadata filters when appropriate.
  • Consider hybrid search for the highest-quality results.
  • Benchmark recall, latency, and throughput using realistic workloads.
  • Monitor index growth and rebuild or optimize indexes when necessary.
  • Store both embeddings and the original source content.

DP-800 Exam Tips

Remember these key points for the exam:

  • Vector search retrieves data based on semantic similarity rather than exact text.
  • Embeddings are numerical representations generated by AI models.
  • The same embedding model should be used for both indexing and querying.
  • Vector indexes improve search performance by reducing the number of vector comparisons.
  • Approximate Nearest Neighbor (ANN) indexes provide fast searches with high recall.
  • Cosine similarity is the most commonly used metric for semantic search.
  • Hybrid search combines keyword search with vector search to improve relevance.
  • Vector search is a core component of Retrieval-Augmented Generation (RAG).

Practice Exam Questions

Question 1

A company is building a chatbot that answers employee questions using internal policy documents. The solution converts both documents and user queries into embeddings before searching for relevant information.

What is the primary purpose of generating embeddings?

A. To compress documents for storage

B. To represent text numerically so semantic similarity can be measured

C. To encrypt sensitive information

D. To improve SQL transaction performance

Answer: B

Explanation:
Embeddings convert text into high-dimensional numerical vectors that capture semantic meaning. These vectors enable similarity comparisons that go beyond exact keyword matching.


Question 2

A developer plans to implement vector search against a database containing 30 million document embeddings.

Which approach provides the best balance between scalability and query performance?

A. Sequentially compare every vector

B. Use a clustered index

C. Use an Approximate Nearest Neighbor (ANN) vector index

D. Create additional foreign keys

Answer: C

Explanation:
ANN indexes are specifically designed to support efficient vector similarity searches across very large datasets while maintaining high recall and low latency.


Question 3

A user searches for:

“Affordable cloud storage”

The returned documents discuss:

  • Cost-effective cloud backup
  • Low-cost online storage
  • Budget-friendly data storage

Why were these documents returned?

A. SQL wildcard matching

B. Lexical keyword matching

C. Primary key lookup

D. Semantic similarity using vector search

Answer: D

Explanation:
Vector search retrieves content based on semantic meaning rather than identical words, enabling related concepts and synonyms to be found.


Question 4

Which statement best describes hybrid search?

A. It combines vector search with keyword or full-text search.

B. It stores vectors in multiple databases.

C. It replaces embeddings with SQL indexes.

D. It searches only relational columns.

Answer: A

Explanation:
Hybrid search combines traditional lexical search with semantic vector search, often producing more relevant and comprehensive search results.


Question 5

Why should the same embedding model be used for both document indexing and query generation?

A. It reduces storage costs.

B. It eliminates the need for vector indexes.

C. It ensures vectors exist in the same semantic space for meaningful comparisons.

D. It automatically creates SQL indexes.

Answer: C

Explanation:
Embeddings generated by different models may occupy different vector spaces, making similarity calculations unreliable and reducing retrieval quality.


Question 6

What is the primary function of a vector index?

A. Encrypt embedding vectors

B. Reduce the number of vector comparisons during searches

C. Compress relational tables

D. Replace SQL indexes

Answer: B

Explanation:
Vector indexes organize embeddings so the search engine evaluates only the most promising candidates instead of comparing every stored vector.


Question 7

A Retrieval-Augmented Generation (RAG) application performs vector search before sending retrieved documents to a large language model.

Why is this retrieval step important?

A. It reduces SQL storage requirements.

B. It converts SQL tables into vectors.

C. It grounds the model with relevant information, improving response accuracy.

D. It eliminates the need for embeddings.

Answer: C

Explanation:
RAG retrieves relevant documents that provide context to the LLM, helping produce accurate, current, and evidence-based responses while reducing hallucinations.


Question 8

Which SQL capability is most commonly combined with vector search to narrow search results to specific business data?

A. Metadata filtering using WHERE clauses

B. ALTER TABLE statements

C. Transaction logging

D. Foreign key constraints

Answer: A

Explanation:
Combining vector search with structured SQL filters allows applications to restrict results by attributes such as department, region, or document type while maintaining semantic relevance.


Question 9

A developer performs vector similarity searches without creating a vector index.

What is the most likely consequence?

A. Embeddings become corrupted.

B. Query performance decreases significantly as the dataset grows.

C. SQL transactions stop working.

D. Documents cannot be embedded.

Answer: B

Explanation:
Without a vector index, the system typically performs an exhaustive comparison against every stored vector, resulting in much slower query performance on large datasets.


Question 10

Which statement best summarizes the role of vector search in AI-enabled database applications?

A. It replaces relational databases.

B. It removes the need for SQL queries.

C. It automatically generates embeddings.

D. It enables retrieval of information based on semantic meaning instead of exact text matching.

Answer: D

Explanation:
Vector search is designed to retrieve semantically similar information by comparing embedding vectors, making it a foundational capability for intelligent search, recommendation systems, and RAG-based applications.


Go to the DP-800 Exam Prep Hub main page

Implement hybrid search (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement intelligent search
      --> Implement hybrid search


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Hybrid search is a core capability for modern AI-enabled database solutions because it combines the strengths of traditional keyword search and vector (semantic) search. By leveraging both lexical and semantic matching techniques, hybrid search delivers more accurate, relevant, and context-aware search results than either approach alone. Hybrid search is widely used in Retrieval-Augmented Generation (RAG) applications, enterprise knowledge bases, AI assistants, recommendation systems, and intelligent search platforms.


What Is Hybrid Search?

Hybrid search combines multiple search techniques into a single query, typically including:

  • Keyword search
  • Full-text search
  • Vector (semantic) search

Instead of relying on only one search method, hybrid search retrieves candidates from multiple search engines and combines the results using a ranking algorithm.

For example, consider a user searching for:

“How do I reduce Azure storage costs?”

A keyword search might find documents containing the exact terms:

  • Azure
  • Storage
  • Costs

A vector search might retrieve documents discussing:

  • Lower cloud expenses
  • Optimize storage spending
  • Reduce infrastructure costs

Hybrid search combines both result sets and ranks the most relevant documents at the top.


Why Hybrid Search Is Important

Neither keyword search nor vector search is perfect by itself.

Keyword Search Strengths

Keyword search excels at finding:

  • Exact product names
  • Error codes
  • File names
  • Database object names
  • Technical terminology

Example:

SQL72014

A keyword search finds documents containing that exact error code.


Keyword Search Weaknesses

Keyword search struggles with:

  • Synonyms
  • Different wording
  • Natural language
  • Conceptual relationships

Example:

Search:

“Vacation policy”

Document:

“Paid time off guidelines”

Although both describe the same concept, keyword search may not find the document.


Vector Search Strengths

Vector search understands meaning.

Example:

Search:

“Improve application speed”

Documents discussing:

  • Performance optimization
  • Query tuning
  • Faster database execution

can all be returned because their embeddings are semantically similar.


Vector Search Weaknesses

Vector search may struggle with:

  • Product IDs
  • Version numbers
  • Error codes
  • Exact names
  • Highly specialized terminology

Example:

Searching for:

SQL71561

works better with keyword search.


Hybrid Search Combines Both Approaches

User Query
Keyword Search
+
Vector Search
Combined Results
Ranking
Top Results

This allows users to benefit from both lexical precision and semantic understanding.


How Hybrid Search Works

A hybrid search implementation generally follows these steps.

Step 1. User Submits a Query

Example:

“How do I configure Azure SQL backups?”


Step 2. Keyword Search Executes

The database searches for:

  • Azure
  • SQL
  • Backups
  • Configure

using:

  • Full-text indexes
  • SQL predicates
  • Traditional search indexes

Step 3. Vector Search Executes

The same query is converted into an embedding.

Query
Embedding Model
Vector

The vector is compared against stored document embeddings.


Step 4. Merge Results

Suppose keyword search returns:

DocumentScore
Backup Overview95
SQL Backup Guide90

Vector search returns:

DocumentScore
Disaster Recovery93
Data Protection88

The system merges these candidate sets.


Step 5. Rank Results

The ranking engine evaluates:

  • Keyword relevance
  • Semantic similarity
  • Metadata
  • Popularity
  • Freshness
  • Business rules

The highest-ranking documents are returned.


Components of a Hybrid Search Solution

Source Documents

Examples include:

  • PDFs
  • Product documentation
  • Knowledge articles
  • Support tickets
  • Policies
  • Emails
  • SQL records

Full-Text Index

Supports traditional keyword searching.

Optimized for:

  • Exact phrases
  • Words
  • Wildcards
  • Boolean searches

Embedding Model

Generates vector representations for documents and queries.

Examples:

  • Azure OpenAI Embeddings
  • OpenAI embedding models
  • Sentence Transformers

The same embedding model should be used during indexing and querying.


Vector Index

Stores embeddings for efficient semantic search.

Examples:

  • HNSW
  • IVF
  • Flat index
  • Product Quantization (PQ)

Ranking Engine

Combines multiple signals into a single relevance score.


Search Pipeline

User Query
Keyword Search
\
\
Ranking Engine
/
/
Vector Search
Combined Results

Both searches occur independently before the results are combined.


Ranking in Hybrid Search

Hybrid search is more than simply combining two result lists.

Each result receives a relevance score based on multiple factors.

Typical ranking signals include:

  • Keyword score
  • Vector similarity score
  • Document freshness
  • Popularity
  • User permissions
  • Metadata
  • Business importance

The ranking algorithm determines the final ordering.


Metadata Filtering

Hybrid search often includes structured SQL filters.

Example:

WHERE Department = 'Finance'

or

WHERE DocumentType = 'Policy'

The search becomes:

Keyword Search
+
Vector Search
+
Metadata Filters
Ranking

Filtering improves both relevance and performance.


Hybrid Search in RAG

Hybrid search is commonly used in Retrieval-Augmented Generation.

Workflow:

User Question
Hybrid Search
Relevant Documents
Large Language Model
Grounded Response

Benefits include:

  • Higher-quality context
  • Reduced hallucinations
  • More complete retrieval
  • Better factual accuracy

Example Scenario

Suppose an employee asks:

“How do I access my benefits after changing jobs?”

Keyword search retrieves:

  • Benefits
  • Jobs

Vector search retrieves:

  • Employee transition
  • HR onboarding
  • Employment status changes

Hybrid search combines both sets, increasing the likelihood of returning the most relevant documents.


Hybrid Search vs Keyword Search

FeatureKeyword SearchHybrid Search
Exact termsExcellentExcellent
SynonymsPoorExcellent
Natural languageLimitedExcellent
Error codesExcellentExcellent
Semantic understandingNoneExcellent
AI applicationsLimitedExcellent

Hybrid Search vs Vector Search

FeatureVector SearchHybrid Search
Semantic understandingExcellentExcellent
Exact identifiersModerateExcellent
Error codesModerateExcellent
Product namesModerateExcellent
Natural languageExcellentExcellent
Overall relevanceHighVery High

Benefits of Hybrid Search

Better Relevance

Combines multiple search signals.


Handles Synonyms

Users don’t need exact wording.


Supports Technical Queries

Keyword search finds:

  • Error codes
  • File names
  • Product names

Supports Natural Language

Vector search understands concepts.


Improved User Satisfaction

Users receive better search results.


Better RAG Responses

The LLM receives more relevant context.


Challenges

Increased Complexity

Two search systems must be maintained.


Higher Resource Usage

Both keyword and vector searches execute.


Ranking Tuning

Determining the correct weighting between keyword and semantic scores may require experimentation.


Embedding Maintenance

Embeddings should be regenerated when source content changes significantly or when migrating to a new embedding model.


Common Hybrid Search Scenarios

Enterprise Knowledge Bases

Employees search documentation using natural language.


Customer Support

Support agents retrieve troubleshooting articles using both error codes and descriptive questions.


Product Catalogs

Customers search using product names, descriptions, or intent.


Healthcare

Clinicians search using symptoms while also matching standardized medical terminology.


Legal Research

Lawyers search using statutes, case numbers, and legal concepts.


Financial Services

Analysts search reports using account identifiers and descriptive business questions.


Best Practices

  • Combine full-text and vector search for production AI applications.
  • Use the same embedding model during indexing and querying.
  • Create appropriate full-text and vector indexes.
  • Apply metadata filters whenever possible.
  • Tune ranking weights using representative user queries.
  • Evaluate both precision and recall during testing.
  • Continuously monitor search quality and user feedback.
  • Refresh embeddings when source documents change significantly.
  • Secure search results using role-based access controls and document permissions.

DP-800 Exam Tips

Remember these key points for the exam:

  • Hybrid search combines traditional keyword search with vector search.
  • Keyword search excels at exact terms, identifiers, and technical strings.
  • Vector search excels at semantic meaning and natural language.
  • Hybrid search generally provides better relevance than either approach alone.
  • Ranking combines multiple signals, including lexical relevance, semantic similarity, and metadata.
  • Metadata filtering improves both performance and result quality.
  • Hybrid search is commonly used in Retrieval-Augmented Generation (RAG) systems.
  • The same embedding model should be used for both indexing and querying to ensure meaningful vector comparisons.

Practice Exam Questions

Question 1

A company is building an AI-powered knowledge base that must support searches for both exact error codes and natural language questions.

Which search approach is most appropriate?

A. Hybrid search

B. Keyword search only

C. Vector search only

D. Relational indexing only

Answer: A

Explanation:
Hybrid search combines keyword and vector search, enabling both exact matching for error codes and semantic matching for natural language queries.


Question 2

A user searches for:

“Improve database response time”

The system returns documents discussing query tuning, indexing strategies, and SQL optimization, even though those exact words were not used.

Which component enabled this behavior?

A. Full-text search

B. Vector search

C. Clustered indexes

D. Foreign key constraints

Answer: B

Explanation:
Vector search compares embeddings that capture semantic meaning, allowing conceptually related documents to be retrieved even when different wording is used.


Question 3

What is the primary purpose of the ranking engine in a hybrid search solution?

A. Generate document embeddings

B. Create vector indexes

C. Combine and order results from multiple search methods

D. Encrypt search results

Answer: C

Explanation:
The ranking engine merges results from keyword and vector searches and orders them using relevance signals such as lexical score, semantic similarity, freshness, and metadata.


Question 4

Which type of query is generally handled most effectively by keyword search?

A. “How can I reduce cloud expenses?”

B. “Best practices for disaster recovery”

C. “Ways to improve SQL performance”

D. “SQL71561”

Answer: D

Explanation:
Exact identifiers such as error codes, product names, and version numbers are best handled using keyword or full-text search.


Question 5

Why is hybrid search commonly used in Retrieval-Augmented Generation (RAG) applications?

A. It eliminates the need for embeddings.

B. It improves retrieval quality by combining lexical and semantic matching.

C. It replaces large language models.

D. It removes the need for vector indexes.

Answer: B

Explanation:
Hybrid search retrieves more comprehensive and relevant information than either keyword or vector search alone, providing higher-quality context to the LLM.


Question 6

A search solution first performs keyword search, then vector similarity search, and finally combines both result sets.

Which step typically follows next?

A. Delete duplicate documents from the database.

B. Recreate all vector indexes.

C. Rank the combined results using relevance signals.

D. Generate new embeddings for every document.

Answer: C

Explanation:
After gathering candidate documents, the ranking engine evaluates multiple relevance signals to determine the final ordering presented to the user.


Question 7

Which statement best describes metadata filtering in hybrid search?

A. It replaces vector search.

B. It restricts search results using structured attributes such as department or document type.

C. It converts SQL tables into embeddings.

D. It automatically updates document embeddings.

Answer: B

Explanation:
Metadata filters narrow the search scope using structured data while still allowing semantic and keyword search within the filtered dataset.


Question 8

A developer configures hybrid search using one embedding model for indexing documents and a different embedding model for processing user queries.

What is the most likely result?

A. Improved semantic accuracy.

B. Reduced index size.

C. Faster query execution.

D. Lower-quality semantic matches because vectors occupy different embedding spaces.

Answer: D

Explanation:
Embeddings produced by different models are generally not directly comparable, leading to poorer semantic similarity calculations and less relevant search results.


Question 9

Which advantage does hybrid search have over vector search alone?

A. It supports exact matching for identifiers while preserving semantic search capabilities.

B. It eliminates the need for full-text indexes.

C. It guarantees mathematically perfect search results.

D. It removes the need for metadata.

Answer: A

Explanation:
Hybrid search enhances vector search by adding lexical matching, making it more effective for exact terms such as product names, file names, and error codes.


Question 10

Which best practice should a database developer follow when implementing hybrid search?

A. Use different embedding models for documents and queries.

B. Disable metadata filtering to improve semantic search.

C. Combine full-text search, vector search, and structured filtering to improve relevance.

D. Use exhaustive vector search for every production workload regardless of size.

Answer: C

Explanation:
A well-designed hybrid search solution combines lexical search, semantic search, and structured metadata filtering to maximize relevance, scalability, and user satisfaction in AI-enabled database applications.


Go to the DP-800 Exam Prep Hub main page