Azure AI Hub LogoAzure AI Hub

01 - Introduction

Introduction to optimizing queries, vectors, and indexing in Azure Cosmos DB for NoSQL.

Introduction

AI applications demand fast, cost-effective data retrieval that scales with growing datasets and increasing query complexity. This module guides you through optimizing query performance for Azure Cosmos DB for NoSQL, helping you reduce latency, lower costs, and handle production workloads efficiently.

The Real-World Scenario

Imagine you're a developer who has built a semantic search platform that helps enterprise users find relevant documents across millions of stored files. Your application stores document metadata, extracted text, and vector embeddings generated by Azure OpenAI. Users search by keywords, filter by date ranges and document types, and expect semantically similar results ranked by relevance under 100 milliseconds.

The Production Problem:

  • Storage and Cost Spikes: The default indexing policy indexes every property, including large embedding arrays that inflate storage costs and RU (Request Unit) consumption.
  • Slow Queries (Latency): Missing composite indexes lead to full container scans.
  • Inconsistent Results: Users complain that recently uploaded documents don't appear in search results immediately.

The Optimization Game Plan:

  • Analyze which queries perform poorly and identify missing indexes.
  • Configure the right indexes (Range, Composite, and Vector) for your access patterns.
  • Select appropriate consistency levels that ensure users see their uploaded content without overspending on RUs.

Next Steps

In this module, you will learn the techniques to transform slow, expensive queries into efficient operations tailored for AI workloads.

On this page