LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

rdst

Diagnose and tune PostgreSQL and MySQL queries from the terminal

TLDR

Run the first-time setup wizard
$ rdst init
copy
Add a database target whose password comes from an environment variable
$ rdst configure add --target [prod] --host [db.example.com] --user [admin] --database [mydb] --password-env [PROD_DB_PASS]
copy
List saved targets
$ rdst configure list
copy
Watch the slowest queries on a target
$ rdst top --target [mydb]
copy
Read aggregated statistics from `pgstatstatements` or MySQL `performance_schema`
$ rdst top --historical --target [mydb]
copy
Analyze one statement with `EXPLAIN`
$ rdst analyze -q "[SELECT * FROM users WHERE active = true]" --target [mydb]
copy
Analyze a query already stored in the registry
$ rdst analyze --hash [abc123] --target [mydb]
copy
Ask a question and print the SQL without running it
$ rdst ask "[How many customers are there?]" --target [mydb] --dry-run
copy
Audit one database
$ rdst audit --target [mydb]
copy
Open the local web UI
$ rdst web
copy
Show the version
$ rdst version
copy

SYNOPSIS

rdst [--config FILE] [-v | --verbose] [--version] COMMAND [ARGS]

DESCRIPTION

rdst is the Readyset Data and SQL Toolkit, a command-line tool for PostgreSQL and MySQL diagnostics. It stores named connection profiles (targets), watches which statements consume database time, and runs `EXPLAIN` so it can suggest indexes, rewrites, and Readyset cache checks.Targets point at PostgreSQL or MySQL. A password is read from an environment variable named with --password-env, or from the operating-system keychain. SSH jump hosts, TLS, and proxies (`readyset`, `proxysql`, `pgbouncer`, `tunnel`, `custom`) can be stored on a target. rdst init walks through the first target. rdst configure adds, edits, tests, and removes targets after that.rdst top ranks statements by frequency, total time, average time, or load. On PostgreSQL the historical source is `pgstatstatements`. On MySQL it can read `performanceschema` digests, the process list, or `mysql.slowlog` when that table is enabled. Statements it sees are saved in a local query registry and can be passed to rdst analyze by hash or name.rdst analyze runs `EXPLAIN ANALYZE` by default and can ask Readyset-hosted inference, or Anthropic when `ANTHROPICAPIKEY` is set, for index and rewrite suggestions. --fast stops at `EXPLAIN`. --readyset-cache checks the statement against a temporary Readyset cache. rdst ask turns a natural-language question into SQL. The project describes that path as guarded and read-only; --dry-run prints the statement and leaves it unexecuted.rdst audit collects a health report for one target. rdst fleet imports or discovers many targets (including Amazon RDS) and can audit them together. rdst schema keeps a semantic layer of table and column notes that rdst ask uses. rdst query manages the saved-query registry. rdst scan looks through a tree for SQLAlchemy, Django, Prisma, and Drizzle queries.rdst web serves the browser UI on `127.0.0.1:8787`. rdst claude add registers RDST as an MCP server for Claude Code, using the `rdst-mcp` entry point. rdst agent and rdst guard wrap a target with safety policies and can expose it over HTTP, MCP, or Slack. rdst demo starts a Dockerized PostgreSQL database loaded with a sample data set.The same toolkit ships inside the RDST desktop app. The CLI is also published on PyPI as `rdst` and through a Readyset install script for macOS and glibc Linux.

PARAMETERS

--config FILE

Path to the configuration file.
-v, --verbose
Verbose output.
--version
Print the version and exit. rdst version does the same.
--target NAME
Which saved database target to use. Accepted by top, analyze, ask, audit, and most other database commands. configure add also treats --name as an alias.
--source SOURCE
For top: `auto` (default), `pgstat`, `activity`, `slowlog`, `digest`, `rds`, or `pmm`. Choosing a source implies **--historical**. For **audit**: `auto`, `pgstat_statements`, or `activity`.
--limit N
How many queries to show. Default 10 for top, 50 for audit.
--historical
Read aggregated statistics instead of a live sample.
--duration SECONDS
For top, sample live activity for N seconds and then print a snapshot. For audit and fleet audit, a window such as `30s`, `5m`, or `1h`.
--watch
Refresh rdst top continuously.
--json
Machine-readable JSON output, where the command supports it.
-q SQL, --query SQL
Inline SQL for analyze (and query add). Mutually exclusive with --file, --stdin, --hash, and --name.
-f FILE, --file FILE
Read the statement from a file.
--stdin
Read the statement from standard input.
--hash HASH, --name NAME
Load a registry query into analyze.
--fast
Use `EXPLAIN` and skip `EXPLAIN ANALYZE`.
--readyset-cache
Verify the statement with a temporary Readyset cache.
--skip-warning
Skip the confirmation prompt before `EXPLAIN ANALYZE`.
--dry-run
For ask, generate SQL and do not execute it. For fleet import and discover, preview changes.
--password-env VAR
Environment variable that holds the database password. The password is kept out of the config file.
--read-only
Mark a configure add target as read-only.
-p PORT, --port PORT
Listen port for rdst web (default 8787).
--host HOST
Bind address for rdst web (default `127.0.0.1`). On configure add, the database host.
--no-browser
Do not open a browser when rdst web starts.
--check
For update, report whether a newer installer release exists. For scan, CI mode.

CONFIGURATION

User data and configuration live in ~/.rdst on Linux and macOS, and in %USERPROFILE%\\.rdst on Windows. --config selects a configuration file. Uninstalling an installer-managed copy leaves ~/.rdst in place.Passwords are not written into the config file. Name an environment variable with --password-env, or let RDST use the OS keychain. rdst configure llm and rdst account login set up Readyset-hosted inference. If `ANTHROPICAPIKEY` is set, AI-assisted commands call Anthropic directly. `RDSTANTHROPICMODEL` overrides that model.Interactive editors use `EDITOR` or `VISUAL`.

COMMANDS

account login|status|logout

Sign in to Readyset for capped hosted AI inference, show the session, or sign out on this machine.
configure add|list|edit|remove|default|test|llm
Manage database targets. add accepts a connection URL or separate --host, --port, --user, --database, and --engine (`postgresql` or `mysql`) fields.
tunnel list|close|test
List or close SSH tunnels held by the local rdst web server, or test a target through its tunnel.
top
Show the slowest queries. --limit defaults to 10. --sort is `totaltime`, `freq`, `avgtime`, or `load`.
analyze
Explain a query given with -q, --file, --stdin, --hash, --name, or a positional SQL string.
ask QUESTION
Generate SQL for a question. --timeout defaults to 600 seconds.
agent create|list|show|delete|chat|serve|mcp|slack
Create a named data agent on a target and talk to it, or serve it over HTTP, MCP, or Slack.
init
First-time setup wizard. --force runs it again when configuration already exists.
query add|import|edit|list|show|delete|rm|export|run|cache-compare
Manage the saved-query registry. cache-compare runs a temporary Readyset comparison.
schema show|init|edit|annotate|export|delete|list|refresh|profile
Manage the semantic layer used by rdst ask.
guard create|list|show|delete|edit|check
Reusable safety policies (masking, query restrictions, execution limits) for data agents.
scan DIRECTORY
Find ORM queries in a tree. --analyze explains them. --check is a CI mode that exits 1 when issues are found. Marked experimental upstream.
fleet configure|import|discover|list|status|audit|diff|snapshots
Manage and audit a group of database targets.
audit
Deep health audit of one target. list and show read saved runs. --duration adds a live capture window such as `5m`.
demo setup|load|tour|teardown
Start, load, tour, and remove the Docker demo database.
claude add|remove
Register or unregister RDST with Claude Code.
slack setup|start|list|status
Run a Slack bot that answers questions against a configured target. Socket Mode, so no public URL is required.
web
Start the local API and browser UI. --port defaults to 8787 and --host defaults to `127.0.0.1`. --no-browser leaves the UI unopened.
report
Send feedback about RDST. Non-interactive use needs -e / --email.
help [QUESTION]
Show command help, or answer a short question from the built-in docs (`rdst help "find slow queries"`).
update
Check or install a release for an installer-managed copy. --check only reports. --version VER installs that release.
version
Print the RDST version.
With no command, rdst opens a numbered menu of these commands. rdst COMMAND --help prints that command's options.

CAVEATS

rdst analyze runs `EXPLAIN ANALYZE` unless --fast is set, so the statement is executed on the target to collect timing. A confirmation prompt is shown unless --skip-warning is passed. --readyset-cache creates a temporary Readyset cache for the check.Historical PostgreSQL rankings need `pgstatstatements`. The MySQL `slowlog` source needs the slow query log written to `TABLE` (`slowquerylog`, `longquerytime`, and `log_output`).The Readyset install script supports macOS and glibc Linux on x86_64 and arm64. rdst update replaces installations created by that script. Copies installed with `uv`, `pipx`, or `pip` stay under those tools (`uv tool upgrade rdst`, `pipx upgrade rdst`).AI-assisted commands send SQL text, plans, and schema to Readyset-hosted inference, or to Anthropic when `ANTHROPICAPIKEY` is set. The project states that those calls do not include table rows. rdst ask without --dry-run still executes the generated statement on the database. rdst demo requires Docker. rdst scan is experimental. The project classifies the 0.1 line as beta.

HISTORY

Readyset published the rdst repository in April 2026 under the Apache License 2.0. The command is versioned on the 0.1 line. A desktop application embeds this CLI and adds a graphical client for the same database targets.

SEE ALSO

psql(1), mysql(1), pgcli(1), mycli(1)

RESOURCES

Copied to clipboard
Kai