Zeta-Lite:面向智能体记忆的并发、可分支浏览器内SQL数据库
Zeta-Lite: A Concurrent, Branchable In-Browser SQL Database for Agentic Memory
浏览论文内容
中文总结 AI 辅助
Zeta-Lite是一款2.87 MB的浏览器内并发可分支SQL数据库,具备异步MVCC核心,性能达268k-315k点读/秒,适配智能体记忆场景,支持PostgreSQL兼容特性与OPFS持久化。
中文摘要 AI 辅助
浏览器已成为一级数据库主机:出于隐私保护、离线运行、本地优先协作,以及最新的浏览器内AI智能体持久化记忆需求,应用越来越希望完全在客户端存储、查询和推理结构化数据。在浏览器中实现SQL的一种方式是将PostgreSQL编译为WebAssembly(PGlite),但它继承了PostgreSQL的进程模型:单个后端连接一次仅执行一条语句且会阻塞,该模型无法实现并发事务,还将图查询、数据库分支等更丰富的功能留给编译后的服务器所包含的内容。我们提出zeta-lite,它是Zeta数据库引擎的浏览器形态:一种WebAssembly构建产物,将相同的Zeta服务器编译为gzip压缩后2.87 MB的工件。Zeta-Lite保留了引擎以日志为中心的异步多版本并发控制(MVCC)核心,具备另外两种浏览器内SQL引擎不具备的能力:一是单线程上的重叠快照隔离事务:多个事务持有不同的读/提交时间戳并交错执行,彼此间存在快照隔离冲突检测;二是写时复制(Copy-On-Write)数据库分支——支持整数据库的分叉、合并和变基,这在浏览器SQL数据库中是独有的,即使在服务器端也很罕见。在此基础上,Zeta-Lite提供了功能完整的PostgreSQL表层特性(包括连接、通用表表达式(CTE)、窗口函数、带GIN索引的JSONB、全文搜索、HNSW向量搜索、SQL/PGQ图查询、多数据库),以及快照到OPFS的持久化。在Chrome、Firefox和原生参考运行时中,Zeta-Lite维持着268k-315k的点读取/秒的性能,混合读写工作负载在数百万次操作中保持平稳。这款小型、功能完整的并发SQL数据库特别适合智能体记忆场景——其中廉价的可分支状态让智能体能够探索、检查并提交或放弃推测性工作。
英文摘要
The browser has become a first-class database host: applications increasingly want to store, query, and reason over structured data entirely on the client - for privacy, offline operation, local-first collaboration, and, most recently, as durable memory for in-browser AI agents. One way to get SQL in the browser, compiling PostgreSQL to WebAssembly (PGlite), inherits PostgreSQL's process model: a single backend connection that executes one statement at a time and blocks. That model cannot express concurrent transactions, and it leaves richer capabilities - graph queries, database branching - to whatever the compiled server happens to include. We present zeta-lite, the browser form factor of the Zeta database engine: a WebAssembly build that compiles the same Zeta server down to a 2.87 MB gzipped artifact. Zeta-lite keeps the engine's log-centric asynchronous MVCC core, which yields two capabilities no other in-browser SQL engine provides. First, overlapping snapshot-isolated transactions on a single thread: multiple transactions hold distinct read/commit timestamps and interleave, with snapshot-isolation conflict detection between them. Second, copy-on-write database branching - whole-database fork, merge, and rebase - is unique in a browser SQL database and rare even in servers. On top of these, zeta-lite exposes a feature-complete PostgreSQL surface (joins, CTEs, window functions, JSONB with GIN indexes, full-text search, HNSW vector search, SQL/PGQ graph queries, multi-database) and snapshot-to-OPFS durability. Across Chrome, Firefox, and a native reference runtime, zeta-lite sustains 268k-315k point reads/s and holds a mixed read/write workload flat over millions of operations. This small, fully-featured, concurrent SQL database is an especially good fit for agentic memory - where cheap branchable state lets an agent explore, inspect, and commit or discard speculative work.