[DISCUSSION] Making Apache Cloudberry an Agent-Native Analytical Database #1967
Replies: 6 comments
Additional context: Lance for multimodal dataIt may be useful to clarify what “AI-native / multimodal data” means here. Lance is an Apache-2.0 open-source file and table format designed for AI datasets. It can keep structured metadata, text, vectors, images, audio, and video in the same versioned dataset. Large media objects can use blob encoding and be loaded lazily, so a system can scan metadata or embeddings first and fetch only the selected media payloads. This is useful because a multimodal dataset is usually more than a collection of vectors. A single video, for example, may have:
Lance is designed for workflows where these derived columns evolve frequently. New embeddings, captions, or predictions can be added without rewriting the original media dataset. The same dataset can then support random access for model training, vector and full-text retrieval for serving, and scans for feature engineering or analytics. Typical applications include:
There are already several publicly documented production examples. These are generally described as Lance or LanceDB deployments; LanceDB is built on the open-source Lance format.
For Cloudberry, the interesting boundary would not be to move media decoding or model training into the database. Lance could remain the external AI-native dataset layer, while Cloudberry provides distributed SQL, joins with native or Iceberg tables, metadata filtering, Vector Top-K pushdown, and aggregation over the retrieved or derived results. That is the main multimodal opportunity: not only “search similar vectors,” but analyze business data and AI-derived information together through one MPP query layer. |
Lance adoption across Apache projectsAnother useful signal is that Lance is no longer isolated from the broader Apache data ecosystem. Several ASF projects already include released Lance integrations at different layers:
There are also ecosystem-level integrations with Apache Spark, Apache Flink, and Apache DataFusion maintained by the Lance community, while Apache Polaris can manage Lance tables through its Generic Table API and a Lance Namespace adapter. These integrations cover several complementary layers: This does not mean that all of these projects use Lance as their default storage format, but it does show growing interoperability and real implementation work across ASF projects. For Cloudberry, the opportunity would be to add a PostgreSQL-compatible MPP analytical path over Lance: distributed scans, joins with native or Iceberg data, Vector Top-K pushdown, and higher-level analytical/RAG capabilities exposed through MCP. |
|
Great direction. I'd suggest referencing TiDB's "data agent" path when planning this out — several pieces are highly relevant:
In short, TiDB's path is roughly "MCP interface → agent memory write-back → multi-tenant architecture," which complements the "FDW → vector pushdown → analytical RAG → MCP tools" |
|
Thanks, this is very helpful. I agree that an MCP-first Phase 0 would give us a lower-cost way to validate the Agent-Native use cases before making the Lance integration too deep. I also agree that a read-only Lance FDW is the right starting point for the storage integration. The write-back point maps well to the “Analytical RAG” part of the proposal. My current understanding is:
I think this kind of AI-derived data write-back should be distinguished from general Agent Memory. The write-back path stores durable analytical results, while Agent Memory may separately cover task checkpoints, previously established facts, user or business context, and selected execution history. We probably do not need to store the agent’s entire reasoning trace. So the architecture could roughly become: Agent → MCP → Cloudberry → Native Tables / Iceberg / Lance With two different paths:
I’ll revise the roadmap ordering along these lines: Phase 0: MCP and agent-facing tools over existing Cloudberry capabilities This keeps the MCP interface independent of the Lance implementation, while giving Lance a clear role in AI-oriented retrieval and Cloudberry native tables a clear role in durable analytical results and agent state. Thanks again — I think this separation makes the proposal and implementation path much clearer. |
|
Thanks for the write-up. The "agent decides what, Cloudberry decides how" boundary makes sense to me, and MCP-first for Phase 0 is the right call. A few points I think need answers before Phase 1, since they decide whether Phases 2–3 are feasible on an MPP engine:
Happy to discuss the fragment-assignment design in (1) further. |
|
Thanks — these are exactly the execution constraints that need to be made explicit. I checked the current Cloudberry and Lance implementations and also ran a small local spike.
Agreed. This should be part of Phase 1, not deferred to distributed Top-K. The QD should pin one Lance dataset version, enumerate its fragments, assign each fragment exactly once, and pass the assignments to the QEs through
The Phase 1 acceptance criteria should include:
I ran a local spike, and the current Lance model makes this feasible. The important distinction is that normal scans can be assigned by data fragment, while indexed ANN should normally be assigned by whole physical index segments. A Lance logical index can contain multiple physical segments, each covering a disjoint fragment subset. Lance also exposes APIs for restricting a query to selected index segment UUIDs. This is the same ownership model used by Lance-Ray's distributed vector search. In a small test with 32,000 vectors, four data fragments, and two physical IVF_FLAT index segments:
I also tested a prefiltered ANN query through the C API. All returned rows satisfied the scalar predicate, and the Top-5 matched an exact filtered search in that test. A separate IVF_PQ experiment confirmed that recall depends materially on For Phase 3, the likely execution model is:
The next spike should run this inside Cloudberry and measure recall against an exact filtered search, along with S3 I/O, skew, and latency.
Agreed. Cloudberry already has distributed pgvector execution. One terminology detail is that the observed Cloudberry plan uses The distinction I would make is:
So Lance is not justified merely by distributed vector search. Its value is avoiding ingestion and duplication of lake-resident multimodal data. I also agree that Phase 2's acceptance test should be a prefiltered ANN query, not only plain
I agree with keeping this as a separate extension, but the interface situation has changed: there is now an official Its C API supports dataset scans, Arrow streams, SQL/Substrait filters, fragment restriction, vector search, index-segment enumeration, and index-segment-scoped search. I verified the read and ANN paths from a pure C11 consumer using the official v0.1.9 binary. There are still two important qualifications:
The v0.1.9 C API can build uncommitted distributed index segments, but I did not find a C API for committing those segments as one logical index. That does not block a read-only FDW consuming existing datasets and indexes, but distributed index construction would currently need another coordinator path or an additional upstream C API. So my current conclusion is: yes to a separate extension, using the official version-pinned |
Uh oh!
There was an error while loading. Please reload this page.
I'd like to discuss a possible direction for Apache Cloudberry: making Cloudberry an open analytical backend for AI agents, rather than building another agent framework inside the database.
AI agents such as Codex, Claude, Maka, and other MCP-compatible agents are increasingly becoming a new interface for interacting with data systems.
The basic idea is:
Cloudberry already has an MCP server and a mature MPP analytical engine.
Therefore, I don't think Cloudberry needs to build another agent runtime.
The external agent can be responsible for:
Cloudberry can focus on what an analytical database is good at:
The responsibility boundary could be:
Structured + AI-Native Data
Cloudberry already provides a strong foundation for structured analytical workloads through SQL, MPP execution, and lakehouse integration.
One possible missing piece is an AI-native data layer.
A possible architecture is:
Iceberg can continue to serve structured analytical/lakehouse workloads.
Lance could complement it as an external data source optimized for AI-oriented datasets.
This could eventually allow queries combining structured business data with semantic or multimodal data.
For example:
Conceptually:
This is closer to analytical RAG than traditional Top-K RAG.
Why Lance?
The goal is not simply to add another vector index.
Lance is interesting because it is designed around AI-oriented datasets containing combinations of:
This makes it potentially useful as an AI-native data layer alongside Iceberg.
Cloudberry could remain responsible for SQL, JOIN, aggregation, MPP execution, and distributed query planning, while Lance provides storage and retrieval capabilities for AI-oriented datasets.
Why Not Just pgvector?
Cloudberry already supports pgvector, and pgvector is a good solution for storing and searching vectors inside PostgreSQL-compatible relational tables.
I see pgvector and Lance as solving different problems.
This is a natural solution when embeddings are part of relational data.
The proposed Lance integration targets external AI-native datasets:
Therefore, Lance would not replace pgvector.
The three layers could coexist:
A simple way to describe the distinction is:
RAG and Hybrid Retrieval
Once Cloudberry can access Lance datasets, we could expose retrieval capabilities through the existing MCP server.
For example:
An external agent could then combine these tools.
For example:
The important point is that Cloudberry does not need to know whether the caller is Codex, Claude, Maka, or another agent.
MCP provides the common interface.
Analytical RAG
A longer-term opportunity is to go beyond traditional RAG.
Traditional RAG usually works as:
This works well for retrieval, but not for questions such as:
This requires:
This could be an interesting area where Cloudberry's existing analytical engine provides capabilities beyond a standalone vector database.
Semantic Layer
Another possible future direction is a lightweight semantic layer.
Instead of requiring an agent to infer business meaning directly from physical schemas, Cloudberry could expose concepts such as:
The external agent could use this semantic information before generating SQL or retrieval requests.
This could improve the reliability of natural-language analytics without requiring Cloudberry itself to implement an agent runtime.
Proposed First Version
I think the first implementation should remain intentionally small.
Phase 1: Read-only Lance FDW
The initial goal could simply be:
For example:
CREATE FOREIGN TABLE lance_documents ( id bigint, customer_id bigint, content text, embedding float4[] ) SERVER lance_server OPTIONS ( uri 's3://bucket/documents.lance' );Initially support:
No INSERT / UPDATE / DELETE would be required initially.
Data could be generated by existing Lance tools or a simple export utility.
Phase 2: Vector Top-K Pushdown
Then support queries such as:
Instead of:
Cloudberry could recognize:
and push the operation into Lance:
This would be the first step toward a vector-aware analytical engine.
Phase 3: Distributed Vector Top-K
Cloudberry's MPP architecture could later provide:
This could become a Cloudberry-specific capability rather than simply exposing Lance APIs.
Possible Roadmap
The whole direction could be explored incrementally:
Each stage is independently useful.
The first experiment is deliberately narrow:
If that proves useful, the higher-level AI analytical capabilities can be explored incrementally.
Long-Term Goal
The goal is not to turn Cloudberry into another vector database or another agent framework.
Instead, the idea is to explore whether Cloudberry can evolve from:
toward:
External agents such as Codex, Claude, Maka, or any other MCP-compatible system could then use Cloudberry as an open-source analytical backend.
I'd especially like feedback from the community on:
All reactions