Show HN:RDST——监控 Postgres/MySQL 查询回归的本地 Agent
英文标题:🔶 Show HN: RDST – A local agent that watches Postgres/MySQL for query regressions
RDST Agent 是一款常驻本地运行的数据库性能 Agent,可通过只读连接持续监控 PostgreSQL 或 MySQL 的查询统计,识别慢查询、性能回归和异常波动。它会依据数据库时间占比对问题排序,并结合 EXPLAIN、执行计划和数据库 schema,给出新增或删除索引、调整参数、改写查询及执行 vacuum 等具体建议。每项建议均提供预估节省时间、受影响查询、适用于自建服务器及 RDS、Aurora、Cloud SQL、Azure 的操作步骤,以及可复制和回滚的 SQL。项目同时提供 Python CLI、浏览器 UI 和 Electron 桌面应用,并可通过 MCP 注册为 Claude Code 的工具服务器。
503 B
1.0 MB
637.4 KB
736.2 KB
30.2 KB
中文
RDST Agent 是一款始终在线的 Agent,能够捕获 PostgreSQL 或 MySQL 数据库中的每一条慢查询,并给出精准的修复方案。它运行在你的机器上,以只读方式连接数据库,并持续维护一份按优先级排序的行动计划:该新增的索引、该删除的索引、该调整的设置,以及该改写的查询。
- 监控每一条查询。 Agent 每分钟读取数据库自身的查询统计信息,因此无需代理或修改代码,就能看到应用实际执行的查询。
- 找出性能成本来源。 它会按查询占用的数据库时间比例进行排序,并标记那些变慢、突增或停止运行的查询。
- 推导修复方案。 对于重要查询,它会运行
EXPLAIN,读取执行计划和 schema,并判断哪些措施会有帮助:缺失索引、服务器设置、查询改写或 vacuum。
每项变更都会附带其可节省的时间、能加速的查询、面向自建服务器或 RDS、Aurora、Cloud SQL 和 Azure 的分步操作说明,以及可直接复制的 SQL;如适用,还会提供用于撤销变更的 SQL。
- 安装桌面应用并添加数据库。 使用只读用户;RDST 会提供创建该用户所需的 SQL。
- 启用 RDST Agent。 它会开始读取 PostgreSQL 的
pg_stat_statements或 MySQL 的performance_schema,数分钟内即可显示你的第一份行动计划。 - 执行行动计划。 从顶部建议开始,复制 SQL,并将已完成的变更标记为完成。Agent 会检查每项变更是否确实带来了改善。
RDST 绝不会向你的数据库写入数据。监控历史、报告和设置均保留在你的机器上,密码则存储在操作系统的凭据存储中。AI 功能会发送 SQL 文本、执行计划和 schema,但绝不会发送表中的行数据。了解 RDST 如何处理你的数据。
此仓库包含的内容
|
---|---
cli/ | rdst Python CLI,以及 UI 调用的 HTTP API
web/ | 浏览器 UI,由 rdst web 提供服务,并嵌入桌面应用
desktop/ | Electron 外壳,将 CLI 作为本地 sidecar 一同发布
packages/ | 共享设计系统:ui-new、ui-icons、tailwind-base、typescript-config
JavaScript 部分需要 Node 22+ 和 pnpm 11;CLI 则需要 Python 3.10+ 及 uv。
pnpm install
pnpm build # web bundle + desktop main process
pnpm --filter rdst-web dev # the UI and a reloading `rdst web` backend
pnpm --filter rdst-desktop dev # the same, inside the Electron shell
pnpm --filter rdst-web dev:vite # the UI alone, against a running `rdst web`
两个 dev 启动器都会通过 uv 从 cli/ 启动 CLI,因此需要在 PATH 中提供 uv,并使用其内置 SQLite 版本足够新、可安全使用 WAL 的 Python 解释器。若没有符合条件的解释器,它们会列出已尝试的解释器。桌面端 sidecar 构建命令 pnpm --filter rdst-desktop build:sidecar 会将 cli/ 冻结为 PyInstaller 包,由打包后的应用启动。它需要 Python 3.12,并且必须先构建 web bundle(pnpm --filter rdst-desktop build:web)。
CLI 是标准 Python 项目,也可以独立构建。其工具链请参见 cli/README.md。
社区构建版本
从这份源码构建的版本使用开放字体和图标:UI 字体采用 Outfit,图标采用 Hugeicons 免费套件;两者与原版的匹配度足够高,因此布局和间距不会变化。参见 LICENSE-THIRD-PARTY。
除非在构建时提供密钥,否则产品分析功能会被编译移除,因此从这份源码构建的版本不会上报任何数据。从这份源码构建的桌面版默认关闭自动更新。
欢迎提交 Pull Request。有关合并流程,请参见 CONTRIBUTING.md。
采用 Apache 2.0 许可证。参见 LICENSE。第三方字体和图标保留各自的许可证,详见 LICENSE-THIRD-PARTY。
在 macOS 或 Linux 上,无需 sudo、pip 或预装 Python:
curl -fsSL https://downloads.readyset.io/packages/rdst-cli/install.sh | sh
它也已发布到 PyPI,或者你可以直接从该仓库安装:
pip install rdst
pip install "git+https://github.com/readysettech/rdst.git#subdirectory=cli"
然后将它指向一个数据库:
rdst init # 引导式设置你的第一个 Postgres 或 MySQL 目标
rdst top # 实时查看命中该数据库的最慢查询
rdst analyze # 分析查询为何缓慢,以及索引或缓存会带来什么效果
rdst web # 在浏览器中打开完整的 RDST UI
rdst claude add # 将 RDST 注册为 Claude Code 的 MCP 服务器
完整文档位于 readyset.io/docs。
English / 原文
RDST Agent is an always-on agent that catches every slow query on your PostgreSQL or MySQL database and gives you the exact fix. It runs on your machine, connects read-only, and keeps a ranked plan of what to do: the index to add, the index to drop, the setting to change, the query to rewrite.
- Watches every query. The agent reads your database's own query statistics every minute, so it sees the queries your app actually runs, with no proxy and no code change.
- Finds what's costing you. It ranks queries by their share of database time and flags the ones that got slower, spiked or stopped running.
- Works out the fix. For the queries that matter, it runs
EXPLAIN, reads the plan and the schema, and decides what would help: a missing index, a server setting, a rewrite, or a vacuum.
Each change comes with the time it saves, the queries it speeds up, step-by-step instructions for your own server or RDS, Aurora, Cloud SQL and Azure, and SQL you can copy, with the SQL to undo it where one applies.
- Install the desktop app and add a database. Use a read-only user; RDST gives you the SQL to create one.
- Turn on RDST Agent. It starts reading
pg_stat_statementson PostgreSQL orperformance_schemaon MySQL, and your first plan shows up within minutes. - Work the plan. Start at the top, copy the SQL, and mark changes done. The agent checks that each one helped.
RDST never writes to your database. Your monitoring history, reports and settings stay on your machine, and passwords live in your operating system's credential store. AI features send SQL text, plans and schema, never the rows in your tables. Read how RDST handles your data.
What's in this repository
|
---|---
cli/ | The rdst Python CLI, and the HTTP API the UI talks to
web/ | The browser UI, served by rdst web and embedded in the desktop app
desktop/ | The Electron shell that ships the CLI as a local sidecar
packages/ | The shared design system: ui-new, ui-icons, tailwind-base, typescript-config
You'll need Node 22+ and pnpm 11 for the JavaScript side, and Python 3.10+ with uv for the CLI.
pnpm install
pnpm build # web bundle + desktop main process
pnpm --filter rdst-web dev # the UI and a reloading `rdst web` backend
pnpm --filter rdst-desktop dev # the same, inside the Electron shell
pnpm --filter rdst-web dev:vite # the UI alone, against a running `rdst web`
Both dev launchers start the CLI out of cli/ with uv, so they need uv on PATH and an interpreter whose bundled SQLite is new enough to be WAL-safe. When none is, they list the interpreters they tried. The desktop sidecar build, pnpm --filter rdst-desktop build:sidecar, freezes cli/ into a PyInstaller bundle the packaged app launches. It needs Python 3.12 and the web bundle built first (pnpm --filter rdst-desktop build:web).
The CLI is a standard Python project and builds on its own. See cli/README.md for its toolchain.
Community builds
Builds from this source use open fonts and icons: Outfit for the UI face and the Hugeicons free set for the icons, matched closely enough that layout and spacing don't change. See LICENSE-THIRD-PARTY.
Product analytics are compiled out unless a key is supplied at build time, so a build from this source reports nothing. Desktop builds from this source have auto-update switched off.
Pull requests are welcome. See CONTRIBUTING.md for how they land.
Apache 2.0. See LICENSE. Third-party fonts and icons keep their own licenses, listed in LICENSE-THIRD-PARTY.
On macOS or Linux, with no sudo, pip or preinstalled Python:
curl -fsSL https://downloads.readyset.io/packages/rdst-cli/install.sh | sh
It's also on PyPI, or you can install it straight from this repository:
pip install rdst
pip install "git+https://github.com/readysettech/rdst.git#subdirectory=cli"
Then point it at a database:
rdst init # guided setup for your first Postgres or MySQL target
rdst top # live view of the slowest queries hitting it
rdst analyze # why a query is slow, and what an index or cache would do
rdst web # the full RDST UI in your browser
rdst claude add # register RDST as an MCP server for Claude Code
Full documentation lives at readyset.io/docs.


