The ApsaraDB team's argument is narrower than its headline and stronger for it: a retrieval-augmented generation pipeline does not need an embedding service, a vector database, synchronisation jobs, a rerank service, an orchestration layer and a business database on top of three copies of the same data. It needs a VECTOR(1024) column, an HNSW index and five SQL functions — AI_EMBEDDING, AI_RANK, AI_PROMPT, AI_CLASSIFY, AI_EXTRACT — shipped in both the standard and enterprise editions of PolarDB-X rather than bolted on as plugins. The interesting part is not the feature list. It is that every external hop the old architecture made over the network now happens inside a statement, and the database inherits the scheduling, failure and capacity behaviour those services used to absorb.
What the Collapse Actually Removes
In a six-component stack the vector store is a derived, eventually consistent index. A row is written to the business database, a sync job notices it, an embedding service converts the text, and an upsert lands in the vector store. Each of those steps has an independent failure mode: a job that dies mid-batch, a retry that duplicates an upsert, a delete that propagates to the row but not to the vector, an embedding computed from text that has since been edited. The cumulative result is drift — an index that returns passages which no longer exist, or fails to return passages that do. These are not exotic defects. They are the ordinary operating cost of any derived store, and they are why "eventually consistent retrieval" is a phrase teams learn to distrust.
Putting the source text, its vector and the index in one engine replaces a queue with a transaction boundary. A delete removes the row and its vector under the same commit, so delete propagation stops being a distributed problem. A row whose embedding is still absent is a queryable state rather than an invisible gap — which is what makes the post's backfill pattern, an UPDATE restricted to rows where embedding IS NULL, more than a convenience. It makes incompleteness explicit, and it makes retries idempotent: a batch that fails halfway leaves the remaining rows in the same recognisable state and can simply be run again.
That is the real technical claim, and it is worth stating precisely: the architecture changes the correctness guarantee from "eventually, if the jobs stay healthy" to "as of a snapshot". For a workload where a stale or ghost retrieval is a defect rather than a nuisance, this is the most defensible argument in the post.
What It Moves: Connections, Snapshots, Timeouts
What the collapse does not do is remove the external calls. AI_RANK and AI_PROMPT still reach a model endpoint over HTTP. The difference is where the wait is accounted for. In a service architecture the orchestrator holds a lightweight request context while the model works, and it can be scaled horizontally at will. Inside a SQL statement the wait is a live server-side execution: a connection is checked out for the full duration of the round trip, and if the statement sits inside an explicit transaction, a snapshot is open and the engine's undo history cannot be purged for as long as it runs.
Throughput therefore becomes a function of connection-pool size and model latency rather than of the model endpoint's capacity. If a rerank call takes a substantial fraction of a second, the number of concurrent retrievals a node can sustain is roughly the pool size divided by that latency, and the queue forms at connection acquisition. That is the least pleasant place for a queue in a MySQL-compatible system, because clients tend to fail there with acquisition timeouts rather than useful errors. Statement timeouts and idle-in-transaction limits become the effective service-level controls.
Every second a model spends thinking is a second a database connection is not available for anything else. The post does not discuss this budget.
Transaction scoping matters for the same reason. A long-lived read view in this engine family blocks purge, so a slow rerank stage that runs inside a transaction can inflate undo history and storage well after the query returns. The post does not state whether the AI functions are permitted or expected to run outside an explicit transaction, so the safe reading is that scoping is left to the application — and that is a decision with measurable consequences. The two-stage retrieval by itself also multiplies cost in a way the post does not quantify: recalling 20 candidates and reranking to 5 means 20 documents scored per query, and it is not stated whether that is one batched rerank call or twenty.
HNSW in a Distributed MySQL: The Unquantified Part
HNSW is a proximity graph. Its cost is memory (each vector plus its link lists), its build time is superlinear in corpus size at fixed degree, and its quality is governed by three parameters conventionally named m, ef_construction and ef_search. The post names the index type and stops there. It gives no build throughput, no memory-per-vector figure, no default or configurable values for those three knobs, and no recall-versus-latency curve. For an index whose entire value proposition is approximate recall at controlled latency, those are the numbers a reader would need to plan a deployment.
Distribution raises questions the post does not answer. If the table is partitioned, does each partition maintain its own graph, with queries fanning out and merging per-shard top-k? If so, recall depends on the per-shard candidate count and tail latency on the slowest shard, and the effective recall of a global top-20 is not the same as the recall of a single-shard top-20. Incremental maintenance is equally unspecified: HNSW deletes typically leave tombstones, and updating a vector means unlinking and re-linking a node, so a workload with heavy churn behaves differently from a bulk-loaded corpus.
Filtered retrieval is the sharpest gap. Combining a metadata predicate with an approximate nearest-neighbour search requires a decision about pre-filtering versus post-filtering. Post-filtering can silently return fewer than the requested k rows when the predicate is selective, and pre-filtering can degrade graph traversal quality when the candidate set is fragmented. The post shows vector distance ordering and a rerank stage, but not the interaction between a WHERE clause on business columns and the index's recall.
The Generated Column Is a Synchronous Dependency
Deriving the vector from stored text in a generated column is the cleanest part of the design: no trigger code to forget, no path by which text changes without the vector following. It also means the write path now contains a call to an external service. An INSERT or UPDATE that touches embedded text cannot complete until the embedding endpoint answers, so write latency and write availability inherit that endpoint's latency and availability.
Failure semantics are the question the post leaves open. If the embedding call fails, does the statement abort, or does the column materialise as NULL? Aborting makes the business database's write availability contingent on a third-party model service. Writing NULL preserves availability but reintroduces exactly the drift the architecture was supposed to eliminate, now in a form that is at least visible to a query. Retry happens at statement granularity, which means the client owns the retry loop.
Backfill carries its own cost. Running UPDATE ... WHERE embedding IS NULL in batches re-embeds and rewrites rows, generating redo/WAL and holding row locks for the duration of each batch, and it competes with live traffic for the same connection pool that already hosts rerank and generation calls. Batch size is a real tuning parameter; the post does not discuss it. Nor does it address model migration: a new embedding model produces a different vector space, so old and new vectors are not comparable and the corpus must be regenerated. With a single vector column, the shadow-column migration strategy and the cutover are not described.
What a Walkthrough Cannot Establish
The post is a worked example — schema, generated column, backfill, two-stage query, one statement that assembles context and calls the model — not an evaluation. It reports no measurement against the six-component stack it replaces. Missing, specifically:
- Latency at percentiles for the combined recall-plus-rerank-plus-generate statement, and the same for the service-based equivalent.
- Recall@k for the vector stage, and how it changes with
ef_searchor with metadata filters. - Concurrency and throughput figures, which is where the connection-budget argument would be settled.
- Cost per thousand queries, including token spend for rerank and generation.
- Failure and retry rates for embedding calls on the write path, and behaviour during an endpoint outage.
A reader can reproduce the schema and the SQL from the post. They cannot reproduce its performance envelope or its operational behaviour under load, because neither is reported.
Where the Pattern Fits, and Where It Does Not
Framed as a trade rather than a verdict: the vector-in-SQL design is a good fit for a moderate corpus whose index fits comfortably in memory and can be rebuilt in an acceptable window, for workloads where retrieval consistency against the system of record genuinely matters, for teams that already run MySQL and would rather not operate a second stateful system, and for query rates low enough that a pool-sized concurrency budget is not the binding constraint.
It fits poorly where rerank or generation calls dominate query time and retrieval traffic must scale independently of transactional traffic; where the corpus is large enough that HNSW build time and memory become first-order capacity planning items; where multi-tenant metadata filters must preserve recall at scale; and where embedding models change often enough that corpus-wide re-embedding is routine. In those cases the six-component stack is not redundant ceremony — it is a way of paying for separate failure domains and separate scaling curves.
The collapse is real. But the complexity is relocated, not deleted: it reappears as connection occupancy, as a synchronous dependency on the write path, and as an index whose recall and memory characteristics the post leaves unstated.
Sources
- Alibaba Cloud Blog (ApsaraDB), "The 6 Components of RAG Actually Just Need 1 Database", https://www.alibabacloud.com/blog/the-6-components-of-rag-actually-just-need-1-database_603795