Skip to content
Microsoft Certified: Azure AI Cloud Developer Associate (AI-200) Exam Prep

Lesson 5 of 7 · 13 min

x
5/7

Domain 2: Develop AI Solutions by Using Azure Data Management Services (Part 3 of 3)

This lesson covers 4 exam topics: Vector Search and RAG in PostgreSQL, Connection Pooling with PgBouncer, Azure Managed Redis: Caching, Expiration, Invalidation, Vector Search and Semantic Caching in Redis. Each topic has a short video, then the notes: key facts, exam traps and what to check in the official docs.

1. Vector Search and RAG in PostgreSQL

Video lesson: AI-200 16/28: Vector Search and RAG in PostgreSQL

Central question: How do you build RAG retrieval with metadata filters in PostgreSQL?

Facts

  • Store embeddings in a vector(n) column next to text and metadata.
  • Similarity: ORDER BY embedding <=> $query LIMIT k (cosine distance); <-> L2, <#> negative inner product.
  • Combine with WHERE filters (tenant, category, date); a partial index matching the WHERE condition helps.
  • Generate embeddings with Azure OpenAI in the app (or the azure_ai extension, general background).

RAG flow (design guidance)

  1. Chunk documents, embed, insert rows with metadata.
  2. Embed the question with the same model.
  3. Filter by metadata + order by distance, top k.
  4. Put chunks in the prompt with citations.

Exam traps

  • Filtering after LIMIT in app code (misses results). Filter in SQL.
  • Different embedding models for rows and queries.
  • Returning chunks without source metadata.

2. Connection Pooling with PgBouncer

Video lesson: AI-200 17/28: Connection Pooling with PgBouncer

Central question: How do you handle many connections efficiently?

Facts

  • Postgres uses a process per connection, so many idle connections are expensive.
  • PgBouncer is built in to flexible server: enable with pgbouncer.enabled = true (no restart), connect on port 6432 with the same host name.
  • Uses server connections only inside a transaction or active query; scales to 10,000 client connections.
  • Default pgbouncer.pool_mode = transaction; supports Microsoft Entra authentication.
  • Supported on General Purpose and Memory Optimized tiers.

Design guidance

Also pool in the app (driver pools), keep transactions short, avoid session-level state (temp tables, SET) in transaction mode, monitor active connections.

Exam traps

  • Connecting to 5432 while expecting pooling.
  • Session state in transaction pooling mode.
  • Enabling PgBouncer on Burstable.

3. Azure Managed Redis: Caching, Expiration, Invalidation

Video lesson: AI-200 18/28: Azure Managed Redis: Caching, Expiration, Invalidation

Central question: How do you cache data correctly with Azure Managed Redis?

Facts

  • Azure Managed Redis is built on Redis Enterprise (Redis 7.4.x); tiers Memory Optimized (8:1 memory:vCPU), Balanced (4:1), Compute Optimized (2:1), Flash Optimized (RAM + NVMe).
  • Azure Cache for Redis Basic, Standard and Premium retire September 30, 2028; migrate to Azure Managed Redis.
  • Cache-aside: read cache → on miss read store and populate; on update write store then invalidate the cache entry.
  • Expiration (TTL) removes stale items; when full, the cache evicts (usually least recently used).

Commands (general background)

SET key value EX 300, GET, DEL (invalidate), EXPIRE, TTL.

Exam traps

  • No TTL, so stale data lives forever.
  • Updating the cache before the store.
  • New build on Azure Cache for Redis instead of Azure Managed Redis.

4. Vector Search and Semantic Caching in Redis

Video lesson: AI-200 19/28: Vector Search and Semantic Caching in Redis

Central question: How do you use Redis as a low-latency vector store?

Facts

  • Vector search needs the RediSearch module; in Azure Managed Redis it must be enabled at creation (modules can't be added later).
  • Index types: FLAT (exact, brute force; small sets) and HNSW (approximate, fast at scale); metrics include Euclidean, cosine, inner product.
  • Use one embedding model consistently; index schema, dimensions and metric must match it.
  • Common uses: RAG retrieval, semantic caching of LLM responses (LangChain integration tutorial).

Semantic cache (design guidance)

Embed the prompt → vector search the cache → if similarity above threshold, return the cached answer (with TTL) → else call the model and store the result. Saves tokens and latency for repeated questions.

Exam traps

  • Creating the cache without RediSearch, then trying to add it.
  • Threshold too loose, returning wrong cached answers.
  • No TTL on cached LLM answers.

References

  1. AI-200 study guide — checked Oct 22, 2026
  2. Use pgvector — checked Oct 22, 2026
  3. Optimize pgvector performance — checked Oct 22, 2026
  4. PgBouncer — checked Oct 22, 2026
  5. What is Azure Managed Redis? — checked Oct 22, 2026
  6. Cache-aside pattern — checked Oct 22, 2026
  7. Retirement FAQ — checked Oct 22, 2026
  8. Vector similarity with Azure Managed Redis — checked Oct 22, 2026

Check your understanding

  • Cosine distance operator?Show answer

    Answer

    <=>.
  • PgBouncer port?Show answer

    Answer

    6432.
  • Pattern: check cache, then database?Show answer

    Answer

    Cache-aside.
  • Module required for vector search?Show answer

    Answer

    RediSearch, enabled at creation.
  • Restrict results to one tenant?Show answer

    Answer

    WHERE tenant_id = ... in the same query.
Previous

Progress is saved in this browser.

Next Lesson