RustDB supports PostgreSQL-style plan inspection via SQL:
EXPLAIN SELECT ...
EXPLAIN INSERT INTO ...
EXPLAIN ANALYZE UPDATE ...
EXPLAIN VERBOSE DELETE FROM ...Keywords ANALYZE and VERBOSE may appear in any order after EXPLAIN.
Results are returned as a single-column result set named QUERY PLAN (one plan line per row). This works from:
rustdb query 'EXPLAIN ...'- QUIC
sql.queryframes (sameResultSetpayload as ordinary SELECT)
| Statement | EXPLAIN |
EXPLAIN ANALYZE |
|---|---|---|
SELECT, set ops (UNION / …) |
Yes | Yes (runs query) |
INSERT / UPDATE / DELETE |
Yes | Yes (runs DML) |
DDL, transactions, PREPARE / EXECUTE |
No | No |
Nested EXPLAIN EXPLAIN ... is rejected at parse time.
Like PostgreSQL, EXPLAIN ANALYZE executes the inner statement. Inserts, updates, and deletes modify data and commit according to the current session (implicit auto-commit or open transaction).
The plan output appends:
Execution Time: <ms>Rows: <n>for queries returning a result setRows Affected: <n>for DML without a result set
Per-operator timings are not available yet (only total wall time).
The displayed tree is the logical plan from the planner/optimizer (Insert, Update, Delete, Table Scan, …). DML execution in the engine uses specialized heap paths that may differ from executing PlanNode::Update in the generic executor. EXPLAIN ANALYZE still measures the real engine path.
rustdb query "EXPLAIN SELECT w_id FROM warehouse WHERE w_id = 1"
rustdb query "EXPLAIN INSERT INTO t (a) VALUES (1)"
rustdb query "EXPLAIN ANALYZE UPDATE t SET a = 2 WHERE a = 1"With VERBOSE, optimizer messages (index selection, predicate pushdown, etc.) are included when the optimizer emits them.