This module covers storing and querying vector embeddings with the pgvector extension on Azure Database for PostgreSQL Flexible Server. You must understand how to enable pgvector via the azure.extensions allowlist, create vector columns with appropriate dimensions, generate embeddings using Azure OpenAI, perform similarity search with distance operators, and build vector indexes for production workloads.
After completing this module, you should be able to:
- Enable the pgvector extension on Azure Database for PostgreSQL Flexible Server
- Create tables with vector columns and choose appropriate dimensions
- Generate embeddings using Azure OpenAI embedding models
- Store embeddings using psycopg with the pgvector adapter
- Perform similarity search using cosine, L2, and inner product distance operators
- Understand dimension limits, storage costs, and float32 conversion
- Build batch embedding pipelines with rate limiting and retry logic
This topic falls under "Implement vector search solutions" within the AI-200 data tier. Expect 3-4 questions covering:
- pgvector extension installation and azure.extensions allowlist
- Distance operator selection (cosine vs L2 vs inner product)
- Embedding model choices and dimension tradeoffs
- Vector storage calculations and dimension limits
- IVFFlat vs HNSW index selection
- Batch embedding patterns and rate limiting
| Resource | Link |
|---|---|
| Use pgvector on Azure Database for PostgreSQL | https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/how-to-use-pgvector |
| Generate embeddings with Azure OpenAI | https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/embeddings |
| pgvector extension overview | https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-extensions#pgvector |
| Azure OpenAI embeddings models | https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#embeddings |
| File | Description |
|---|---|
| notes.md | Comprehensive study notes for pgvector embeddings |
| cheat-sheet.md | SQL commands, distance operators, index types, gotchas |
| practice-questions.md | 10 exam-style practice questions with explanations |
| hands-on-lab.md | Step-by-step labs: enable pgvector, store embeddings, search |
| code-examples/ | Python pgvector examples with Azure OpenAI |