Query Analysis
The four RDST commands that help you find, understand, and explore SQL queries.
RDST has four commands that help you work with SQL queries. They share a common foundation — the query registry, so a query found by one command can be analyzed, cached, or re-run by another.
Which command do I reach for?
| If you want to... | Use |
|---|---|
| See which queries are actively consuming the most database time | rdst top |
| Get a full analysis of one specific query | rdst analyze |
| Translate a plain-English question into SQL and run it | rdst ask |
| Find SQL queries in your application's source code (ORMs included) | rdst scan |
A common workflow
The four commands are often used together:
# 1. Find the slowest queries on a target
rdst top --target prod-orders
# 2. Analyze one of them
rdst analyze --hash a1b2c3d4e5f6 --target prod-orders
# 3. Explore related data in plain English
rdst ask "Which customers trigger this query most often?" --target prod-orders
# 4. Find where the query comes from in your code
rdst scan ./backend --schema prod-orders --diff HEADEvery command in this section saves the queries it touches to the registry. You
never need to copy a query from one command's output to another's input — use
--hash <id> instead.