diff --git a/README.md b/README.md index 41499d3..af42067 100644 --- a/README.md +++ b/README.md @@ -1,98 +1,89 @@ -# Doltgres is Dolt for Postgres! + +> [!NOTE] +> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。 +> [English](./README.en.md) · [原始项目](https://github.com/dolthub/doltgresql) · [上游 README](https://github.com/dolthub/doltgresql/blob/HEAD/README.md) +> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。 + +# Doltgres 是面向 Postgres 的 Dolt! -From the creators of [Dolt](https://www.doltdb.com), the world's first version controlled SQL -database, comes [Doltgres](https://www.doltgres.com), the Postgres-flavored version of Dolt. It's a -SQL database that you can branch and merge, fork and clone, push and pull just like a Git -repository. Connect to your Doltgres server just like any Postgres database to read or modify schema -and data. Version control functionality is exposed in SQL via system tables, functions, and -procedures. +来自 [Dolt](https://www.doltdb.com), 全球首个支持版本控制的 SQL +数据库的创作者,现推出 [Doltgres](https://www.doltgres.com), Dolt 的 Postgres 版本。这是一款 SQL +数据库,你可以像使用 Git 仓库一样对它进行分支(branch)与合并(merge)、复刻(fork)与克隆(clone)、推送(push)与拉取(pull)。你可以像连接任何 Postgres 数据库一样连接到 Doltgres 服务器来读取或修改 schema +和数据。版本控制功能通过 SQL 中的系统表、函数和存储过程公开。 -Git versions file, Doltgres versions tables. It's like Git and Postgres had a baby. +Git 为文件做版本控制,Doltgres 为表做版本控制。它就像是 Git 和 Postgres 的孩子。 -# Doltgres is Beta +# Doltgres 处于 Beta 阶段 -[Doltgres is now Beta quality](https://dolthub.com/blog/2025-04-16-doltgres-goes-beta/), which means -it's ready for your production use case. There will be bugs and missing features, but [we can fix -most of them in 24 hours](https://www.dolthub.com/blog/2024-05-15-24-hour-bug-fixes/) if you [file -an issue](https://github.com/dolthub/doltgresql/issues). +[Doltgres 现已达到 Beta 质量](https://dolthub.com/blog/2025-04-16-doltgres-goes-beta/), 这意味着 +它已可用于你的生产场景。仍会有 bug 和功能缺失,但如果你 [提交 issue](https://github.com/dolthub/doltgresql/issues). +[我们大多能在 24 小时内修复](https://www.dolthub.com/blog/2024-05-15-24-hour-bug-fixes/) -The wait is over! Now is the time to [try out Doltgres](#getting-started) and let us know what you -think. Import your existing Postgres database into Doltgres with `pg_dump` and `psql`, and let us -know if anything doesn't work. +等待结束了!现在是 [试用 Doltgres](#getting-started) 并告诉我们你的想法的时候了。使用 `pg_dump` 和 `psql` 将你现有的 Postgres 数据库导入 Doltgres,如果有任何不工作的地方请告诉我们。 -If you're excited about this project, you can also help speed it along in a few other ways: +如果你对这个项目感到兴奋,还可以通过以下几种方式帮助推动项目进展: -- Star this repo -- Create [issues](https://github.com/dolthub/doltgresql/issues) if you find bugs -- Create [issues](https://github.com/dolthub/doltgresql/issues) for missing functionality you want -- Contribute code for features you want (see the [Contribution - Guide](https://github.com/dolthub/doltgresql/blob/main/CONTRIBUTING.md)) -- Tell your friends and colleagues +- 给本仓库点 Star +- 如果发现 bug,请创建 [issues](https://github.com/dolthub/doltgresql/issues) +- 为你想要但缺失的功能创建 [issues](https://github.com/dolthub/doltgresql/issues) +- 为你想要的功能贡献代码(参见 [贡献指南](https://github.com/dolthub/doltgresql/blob/main/CONTRIBUTING.md)) +- 告诉你的朋友和同事 -# Full Documentation +# 完整文档 -Doltgres has a [documentation website](https://doltgres.com/docs) with extensive documentation. +Doltgres 拥有 [文档网站](https://doltgres.com/docs),其中包含大量文档。 -# Installation +# 安装 -To install Doltgres on Linx or Mac based systems run this command in your terminal: +要在基于 Linx 或 Mac 的系统上安装 Doltgres,请在终端中运行以下命令: ``` sudo bash -c 'curl -L https://github.com/dolthub/doltgresql/releases/latest/download/install.sh | bash' ``` -This will download the latest doltgres release and put it in `/usr/local/bin/`, which is probably on -your `$PATH`. +这将下载最新的 doltgres 发行版并将其放入 `/usr/local/bin/`,该路径很可能已在你的 `$PATH` 中。 ## Windows -Download the latest Microsoft Installer (`.msi` file) in -[releases](https://github.com/dolthub/doltgresql/releases) and run it. +在 [releases](https://github.com/dolthub/doltgresql/releases) 下载最新的 Microsoft Installer(`.msi` 文件)并运行。 ## Docker -Doltgres publishes an official Docker image on every release: +Doltgres 在每次发布时都会提供官方 Docker 镜像: * [dolthub/doltgresql](https://hub.docker.com/r/dolthub/doltgresql) -Run it on your local Docker like this: +在本地 Docker 中这样运行: ```bash $ docker run -e DOLTGRES_PASSWORD=myPassword -p 5432:5432 dolthub/doltgresql:latest ``` -## Building From Source +## 从源码构建 -To produce a binary from source code, run `./scripts/build.sh`. +要从源码生成二进制文件,请运行 `./scripts/build.sh`。 -# Getting Started +# 快速入门 -1. Run `doltgres`. This will create a `postgres` user and a `postgres` database in the current -directory. The default password will be `password`, just like in Postgres. You can use a -`config.yaml` file or set the `DOLTGRES_DATA_DIR` environment variable to use a different directory -for your databases. +1. 运行 `doltgres`。这将在当前目录中创建一个 `postgres` 用户和一个 `postgres` 数据库。默认密码为 `password`,与 Postgres 中一样。你可以使用 `config.yaml` 文件或设置 `DOLTGRES_DATA_DIR` 环境变量来为数据库使用不同的目录。 -You can change the name and password of the super-user by setting the `DOLTGRES_USER` and -`DOLTGRES_PASSWORD` environment variables before running `doltgres` for the first time. +你可以在首次运行 `doltgres` 之前,通过设置 `DOLTGRES_USER` 和 `DOLTGRES_PASSWORD` 环境变量来更改超级用户的名称和密码。 ```bash $ doltgres INFO[0000] Server ready. Accepting connections. ``` -2. Install Postgres to get the `psql` tool. I used Homebrew to install Postgres on my Mac. This -requires I manually add `/opt/homebrew/opt/postgresql@15/bin` to my path. We only need Postgres in -order to use `psql`, so feel free to skip this step if you already have `psql`, or if you have -another Postgres client you use instead. +2. 安装 Postgres 以获取 `psql` 工具。我在 Mac 上使用 Homebrew 安装了 Postgres。 这需要我手动将 `/opt/homebrew/opt/postgresql@15/bin` 添加到 path。我们只需要 Postgres 来使用 `psql`,因此如果你已有 `psql`,或使用其他 Postgres 客户端,可以跳过此步骤。 ``` export PATH="/opt/homebrew/opt/postgresql@15/bin:$PATH" ``` -3. Open a new terminal. Connect with the following command: `PGPASSWORD=password psql -h localhost --U postgres`. This will connect to the `postgres` database with the `postgres` user. +3. 打开新终端。使用以下命令连接:`PGPASSWORD=password psql -h localhost +-U postgres`. This will connect to the `postgres` database with the `postgres` 用户。 ```bash $ PGPASSWORD=password psql -h localhost @@ -102,7 +93,7 @@ Type "help" for help. postgres=> ``` -4. Create a `getting_started` database. Create the `getting_started` example tables. +4. 创建一个 `getting_started` 数据库。创建 `getting_started` 示例表。 ```sql postgres=> create database getting_started; @@ -146,7 +137,7 @@ getting_started=> \d (3 rows) ``` -5. Make a Dolt Commit. +5. 创建 Dolt Commit。 ```sql getting_started=> select * from dolt.status; @@ -177,7 +168,7 @@ getting_started=> select dolt_commit('-m', 'Created initial schema'); (1 row) ``` -6. View the Dolt log. +6. 查看 Dolt 日志。 ```sql getting_started=> select * from dolt.log; @@ -188,34 +179,29 @@ getting_started=> select * from dolt.log; (2 rows) ``` -7. Continue with [Dolt Getting Started](https://dolthub.com/docs/introduction/getting-started/database#insert-some-data) - to test out more Doltgres versioning functionality. +7. 继续阅读 [Dolt 快速入门](https://dolthub.com/docs/introduction/getting-started/database#insert-some-data) + 以体验更多 Doltgres 版本控制功能。 -# Limitations and differences from Dolt +# 与 Dolt 的限制和差异 -- No [Git-style CLI](https://dolthub.com/docs/cli-reference/cli) for version control like in - [Dolt](https://github.com/dolthub/dolt), only a SQL interface. -- Can't push to DoltHub or DoltLab, only custom remotes (such as on the file system or to S3). -- Backup and replication are a work in progress. -- No GSSAPI support. -- No extension support yet. -- Some Postgres syntax, types, functions, and features are not yet implemented. If you encounter a - missing feature you need for your application, please [file an issue to let us - know](https://github.com/dolthub/doltgresql/issues). +- 没有像 [Dolt](https://github.com/dolthub/dolt), 中那样的 [Git 风格 CLI](https://dolthub.com/docs/cli-reference/cli) 来做版本控制,仅有 SQL 接口。 +- 无法推送到 DoltHub 或 DoltLab,仅支持自定义 remote(例如文件系统或 S3)。 +- 备份和复制功能仍在开发中。 +- 不支持 GSSAPI。 +- 尚不支持扩展。 +- 部分 Postgres 语法、类型、函数和功能尚未实现。如果你遇到应用所需但缺失的功能,请 [提交 issue 告知我们](https://github.com/dolthub/doltgresql/issues). -# Performance +# 性能 -Dolt is [1.1X slower than MySQL](https://dolthub.com/docs/sql-reference/benchmarks/latency) as -measured by a standard suite of Sysbench tests. +根据标准 Sysbench 测试套件衡量,Dolt 比 MySQL [慢 1.1 倍](https://dolthub.com/docs/sql-reference/benchmarks/latency)。 -We use these same Sysbench tests to benchmark DoltgreSQL and compare the results to PostgreSQL. +我们使用相同的 Sysbench 测试对 DoltgreSQL 进行基准测试,并将结果与 PostgreSQL 进行比较。 -Here are the benchmarks for DoltgreSQL version `0.50.0`. All figures are median latency in -milliseconds. +以下是 DoltgreSQL 版本 `0.50.0` 的基准测试结果。所有数值均为以毫秒为单位的中位延迟。 -| Read Tests | Postgres | Doltgres | Multiple | +| 读取测试 | Postgres | Doltgres | 倍数 | | --- | --- | --- | --- | | covering_index_scan_postgres | 1.89 | 5.28 | 2.8 | | groupby_scan_postgres | 5.28 | 46.63 | 8.8 | @@ -230,8 +216,7 @@ milliseconds. | types_table_scan_postgres | 43.39 | 292.6 | 6.7 | | reads_mean_multiplier | | | 6.3 | - -| Write Tests | Postgres | Doltgres | Multiple | +| 写入测试 | Postgres | Doltgres | 倍数 | |------------------------------|----------|----------|----------| | oltp_delete_insert_postgres | 2.22 | 6.79 | 3.1 | | oltp_insert | 1.1 | 3.68 | 3.3 | @@ -242,42 +227,38 @@ milliseconds. | types_delete_insert_postgres | 2.3 | 7.04 | 3.1 | | write_mean_multiplier | | | 3.6 | -| Overall Mean Multiple | 5.2 | +| 总体平均倍数 | 5.2 | | --------------------- | --- |
-# Correctness +# 正确性 -Dolt is [100% compatible](https://dolthub.com/docs/sql-reference/benchmarks/correctness) with MySQL -based on a standard suite of correctness tests called `sqllogictest`. +Dolt 基于称为 `sqllogictest` 的标准正确性测试套件,[与 MySQL 100% 兼容](https://dolthub.com/docs/sql-reference/benchmarks/correctness)。 -We use these same tests to measure the correctness of DoltgreSQL. +我们使用相同的测试来衡量 DoltgreSQL 的正确性。 -Here are DoltgreSQL's sqllogictest results for version `0.50.0`. Tests that did not run could not -complete due to a timeout earlier in the run. +以下是 DoltgreSQL 版本 `0.50.0` 的 sqllogictest 结果。未运行的测试是因为本次运行中更早阶段发生超时而无法完成。 -| Results | Count | +| 结果 | 数量 | | -- | -- | -| did not run | 91270 | -| not ok | 411415 | -| ok | 5188604 | -| timeout | 16 | -| Total Tests | 5691305 | +| 未运行 | 91270 | +| 失败 | 411415 | +| 通过 | 5188604 | +| 超时 | 16 | +| 测试总数 | 5691305 | -| Correctness Percentage | 91.16721 | +| 正确率 | 91.16721 | | -- | -- |
-# Architecture +# 架构 -Doltgres emulates a Postgres server, including parsing Postgres SQL into an Abstract Syntax Tree (AST). This AST is -converted to a form that can be interpreted by the Dolt engine. Doltgres uses the same SQL engine and storage format as Dolt. +Doltgres 模拟 Postgres 服务器,包括将 Postgres SQL 解析为抽象语法树(Abstract Syntax Tree,AST)。该 AST 会被转换为 Dolt 引擎可解释的形式。Doltgres 使用与 Dolt 相同的 SQL 引擎和存储格式。 -[Dolt has a unique architecture](https://dolthub.com/docs/architecture/architecture) that allows for version control -features at OLTP database performance. Doltgres uses the same architecture. +[Dolt 具有独特的架构](https://dolthub.com/docs/architecture/architecture),可在 OLTP 数据库性能级别支持版本控制功能。Doltgres 使用相同的架构。