How to upgrade embedding models in AlloyDB AI with zero downtime
The existing dataset must be re-embedded using the new model — typically requiring complex dual-write pipelines while both old and new models run side by side.
By Dillip Chowdary • Dec 05, 2026 • Source: Google Cloud Blog

At a glance
- Product
- AlloyDB AI (Google Cloud)
- Backfill speed
- up to 3,000 embeddings/second
- ScaNN vs HNSW
- 10x faster index builds
- Extension
- google_ml_integration ≥ 1.5.6 (tested on 1.6.1)
- Migration example
- text-embedding-005 (768-d) → gemini-embedding-001 (3072-d)
- Lock timeout
- SET lock_timeout = '2s' for column addition
In this post
Google published a step-by-step walkthrough on October 29 showing how AlloyDB AI supports zero-downtime embedding model upgrades, combining auto embeddings, ScaNN index builds, and standard PostgreSQL operations to avoid the maintenance windows that typically accompany a switch between vector embedding models in production. Per Google Cloud Blog's report, the technique demonstrated migrating a production table from text-embedding-005 (768 dimensions) to gemini-embedding-001 (3072 dimensions) while serving live traffic.
This article is for database engineers and application developers who manage AlloyDB AI clusters in production and want to adopt newer embedding models without scheduled downtime.
01Four problems a live embedding migration must solve
Upgrading embedding models in production creates four simultaneous challenges. The existing dataset must be re-embedded using the new model — typically requiring complex dual-write pipelines while both old and new models run side by side. Embeddings from different models inhabit mathematically incompatible vector spaces, so application query vectors and stored column vectors must switch models in unison to prevent search degradation.
Vector indexes must be rebuilt on the new embedding column before similarity search performs efficiently at scale. And DDL operations and other schema migrations can acquire exclusive locks that stall incoming read and write transactions if not carefully timed.
02AlloyDB AI backfill at up to 3,000 embeddings per second
AlloyDB AI addresses the backfill problem through the auto embeddings feature, which generates new embeddings in the background at up to 3,000 embeddings per second and tracks which rows change during the backfill so only modified rows need refreshing afterward. The ScaNN index builder is 10x faster than open-source HNSW, compressing the window between backfill completion and efficient similarity search. Native PostgreSQL concurrent index creation and atomic column renames enable transparent blue/green and canary-style rollouts without application-level code changes.
The google_ml_integration extension must be at version 1.5.6 or later (the walkthrough was tested on 1.6.1) to access the full feature set. Model endpoint management provides native in-database access to first-party, third-party, or self-hosted embedding models.
Auto embeddings offers two refresh modes:
| Mode | Behavior | Best for |
|---|---|---|
| transactional | Embeddings updated inline on every INSERT/UPDATE | Low write rate; need strict consistency |
| manual | AlloyDB tracks changed rows; refresh runs on a schedule via ai.refresh_embeddings() | High write rate; can tolerate brief embedding drift |
Advertisement
Tech Pulse Daily
Get tomorrow's pulse first
Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.
03Five-step migration walkthrough on a live table
The walkthrough migrates ecomm.product_reviews live. Step 0 verifies extension version and model connectivity. Step 1 adds the new 3072-dimension vector column with SET lock_timeout = '2s' to prevent blocking production traffic if an exclusive lock takes too long — if it fails, simply retry.
- Preflight check verify google_ml_integration ≥ 1.5.6, confirm gemini-embedding-001 returns 3072-d vectors
- Add column ALTER TABLE ecomm.product_reviews ADD COLUMN new_embedding_col vector(3072) with 2-second lock timeout
- Initialize backfill call ai.initialize_embeddings() with model_id, table_name, content_column, embedding_column, batch_size=50, incremental_refresh_mode='manual'
- Catch-up refresh run ai.refresh_embeddings() for rows modified during backfill; schedule via pg_cron for ongoing drift
- Validate and cut over check for missing embeddings, spot-check vector distances, then use atomic column rename for the cutover
04Writer wait time vs. backfill duration trade-off
During backfill, AlloyDB processes rows in parallel groups (batch_size × max_parallel_requests). Concurrent writes must wait for each micro-batch to commit. Lowering max_parallel_requests reduces how long writers wait per batch but increases total backfill wall-clock time.
Benchmarks on a 10,000-row table show the trade-off:
| max_parallel_requests | Longest concurrent writer wait | Total backfill duration |
|---|---|---|
| 400 (default) | 5.1 seconds | 5.2 seconds |
| 20 | 0.39 seconds | 7.6 seconds (+46%) |
Teams running busy transactional tables can lower max_parallel_requests in the backfill session using SET google_ml_integration.max_parallel_requests = 20 to protect write latency at the cost of a longer total backfill time.
05Monitoring progress and validating before cutover
AlloyDB provides ai.embedding_progress_view to track backfill status, including percent_progress, rows_processed, error_count, and estimated_time_remaining. Query it from a separate session during Step 3 to watch progress without interrupting the backfill operation.
Before traffic cutover, two validation queries confirm correctness: a count of rows where new_embedding_col IS NULL (should approach zero), and a max distance check comparing stored embeddings against a fresh model invocation (should approach zero). To avoid skewed results from rows still in-flight, filter on google_ml_track_stale_embedding = 'false', which limits the check to rows that have not changed since the last ai.refresh_embeddings() call. The column rename in Step 5 is an atomic operation in PostgreSQL, allowing a transparent blue/green-style cutover with no application-level changes required.
Frequently asked questions
How fast does AlloyDB AI backfill embeddings?
AlloyDB AI auto embeddings generates new embeddings in the background at up to 3,000 embeddings per second, using efficient batch processing.
What is the difference between transactional and manual refresh modes in AlloyDB auto embeddings?
Transactional mode updates embeddings inline on every INSERT or UPDATE, keeping data fully consistent but adding write latency. Manual mode tracks changed rows without updating immediately, allowing a scheduled ai.refresh_embeddings() refresh — better for high write-rate tables that can tolerate brief embedding drift.
How do I limit the impact on concurrent writers during an AlloyDB embedding backfill?
Set google_ml_integration.max_parallel_requests to a lower value (e.g., 20 instead of the default 400). On a 10,000-row table, this cut the longest concurrent writer wait from 5.1 seconds to 0.39 seconds at the cost of a 46% longer total backfill time.
What AlloyDB extension version is required for zero-downtime embedding upgrades?
The google_ml_integration extension must be version 1.5.6 or later. The walkthrough was tested on version 1.6.1.
Sources
Author
Dillip Chowdary
Writes Tech Bytes coverage of AI, engineering, and the tools that actually ship. Editor of Tech Pulse Daily.
Related on Tech Bytes
Advertisement