EN
返回档案库

档案库 · 开发与企业工具 · 产品决策 · 2022–2026

Cozo押注:Datalog加关系代数胜过SQL和属性图

CozoDB发布了一款可嵌入的Rust数据库,用Datalog查询关系图数据;其2022年的Show HN获得了425分,仓库现显示4.1k星。

CozoDB

它在赌什么连接数据最好用Datalog在关系模型上查询——可组合、可递归,而SQL和属性图则不然——并且像SQLite一样嵌入。已上线

做的是什么生意

CozoDB is an open-source, transactional database written in Rust that stores relational data and queries it with a Datalog dialect supporting recursion, aggregations, time travel and built-in graph algorithms, plus HNSW vector search inside Datalog since v0.6. It runs embedded in the host process or as a server, on desktop, mobile or in the browser through WASM, over storage backends from in-memory and SQLite to RocksDB and TiKV.

起因

The author (HN handle zh217) had been building Cozo for about half a year when he posted the Show HN on 2022-11-08, because he wanted a graph database that was lightweight and easy to use like SQLite yet powerful and performant like Postgres and found none good enough. He judged Cypher little more expressive than SQL common-table-expressions, Gremlin not declarative enough, property-graph models over-constraining and triple stores slow, so he chose Datalog as the query language and relational algebra as the data model — his first significant project in Rust.

经过

CozoDB grew language bindings for Python, NodeJS, Clojure, Go (through the C API), Rust and a standalone HTTP server, and the README advertised cross-platform support from phones to the browser. Version v0.6 added HNSW vector search integrated inside Datalog so vectors can be joined, unified and even recursed over like ordinary relations; v0.7 added MinHash-LSH near-duplicate search, full-text search and JSON value support. The README published performance numbers — roughly 100K queries per second on a mixed read/write OLTP workload over a 1.6M-row relation on a 2020 Mac Mini, two-hop graph traversal in under a millisecond on a 31M-edge graph — while the project stayed pre-1.0 and MPL-2.0 open source.

结果

Still running as of the 2026-09-05 snapshot: the repository showed 4.1k stars, 164 forks and 1,813 commits, and the README still described CozoDB as young and pre-1.0; no funding round, company formation, acquisition, pivot or shutdown is disclosed in the material.

背景

CozoDB是一款用Rust编写的开源事务性数据库,存储关系数据并使用Datalog(一种逻辑语言,其递归性使图查询变得自然)进行查询。它像SQLite一样可嵌入——在宿主进程、手机或通过WASM在浏览器中运行——但也可以作为服务器运行,使用RocksDB或TiKV存储以支持更大的数据集,并提供Python、NodeJS、Clojure、Go和Rust绑定。

2022-11-08的Show HN中提出的赌注是,连接数据最好用Datalog在关系模型上查询:作者认为SQL公用表表达式难以组合,像Neo4j这样的属性图模型过度约束,而三元组存储存在性能问题,因此他围绕关系代数加递归、时间旅行和固定图算法构建了Cozo。

CozoDB在添加功能时保持为一个开放、预1.0的项目:v0.6在Datalog中引入了HNSW向量搜索,允许嵌入向量像任何关系一样被连接和递归,v0.7增加了MinHash-LSH、全文搜索和JSON值。截至2026-09-05快照,仓库显示4.1k星、164个复刻和1813次提交,未披露任何融资、公司成立或转向。

这件事要成立,得有什么

  • 可嵌入性让开发人员能像采用SQLite一样采用Cozo——无需运行服务器——而RocksDB和TiKV后端则回答了“大数据怎么办”的异议。
  • Datalog中的递归比SQL递归更容易表达,而这是图查询最需要的操作。
  • 关系代数保持模型可组合:查询返回可存储和重用的关系,而属性图和三元组存储模型则强制笨拙的往返。
  • 在Datalog中添加向量搜索使数据库面向LLM时代的工作负载,而无需添加第二种查询语言。

可借鉴之处

选择批评者称为老旧的基底:Datalog加关系代数给Cozo带来了SQL、属性图和三元组存储所缺乏的递归和可组合性——架构本身即是宣传点。

后续进展

截至2026-09-05快照,CozoDB仍然活跃且预1.0:GitHub仓库显示4.1k星、164个复刻和1813次提交,README仍将项目描述为非常年轻,承诺在1.0版本之前不保证语法、API或存储兼容性。绑定涵盖桌面、移动和浏览器平台,文档记录了从v0.6开始Datalog中的HNSW向量搜索。材料未披露任何融资、公司成立、收购、转向或关闭。

资料来源

发现哪里写错了?告诉我们。

轮到你了

你刚读完一家。说说你在做什么,看看谁在赌同一件事。

免费账号 · 3 次免费提问 · 不用绑卡

相关案例