Developer Docs: PROD-Safe Tuning, 12 Engines & 32 MCP Tools
Complete engineering reference covering Rust 1.100 builds, default EnvMode::Prod slow_diag, 1-click zero-PII local DEV+TEST twins, Zipf 100K seeding, 6-rule AST + ESR+INCLUDE index advisor, HMAC dual-gate promotion_verifications.json, 32 MCP CLI tools & Ed25519 signing.
Quickstart, Binaries & Rust 1.100 Source Build
Built natively in Rust 1.100 (Edition 2024) + GPUI Community Edition without Electron overhead. Launch on macOS or Windows and initialize the built-in e-commerce SQLite demo DB in one click.
- • macOS: Apple Silicon (arm64) & Intel (x86_64) native Metal GPUI window + Info.plist sqlstudio:// scheme.
- • Windows 10/11: x64 DirectX/Win32 native binary with Per-Monitor DPI v2 & HKCU protocol registration.
- • Demo Seed DB: Auto-creates sample tables (users, orders, payments) inside $SQLSTUDIO_HOME for instant orphan/index audit testing.
7 Native Drivers + 5 Dialect & Probe Engines
Read-only pg_stat_statements bottleneck scan, n_dead_tup bloat & cold-stats guard, ESR+INCLUDE advisor, loopback DEV+TEST twins & EXPLAIN (FORMAT JSON).
Read-only performance_schema digest diagnostics, Seq Scan detection, ESR composite indexes, 6-rule AST rewrites & A/B benchmarking.
MariaDB system catalogs, FK coverage & slow-query checks, local sandbox verification & bidirectional DDL.
Zero-prod-disk local DEV/TEST twin target, PRAGMA foreign_key_check, 100K-row Zipf seeding & EXPLAIN QUERY PLAN A/B compare.
Zero-prod-disk analytical local DEV/TEST twin target, skewed dataset benchmarking & columnar execution plan profiling.
HTTP interface & system catalog introspection, sorting key metadata inspection & read-only analytical execution.
Native RESP protocol, db0..dbN switching, bounded SCAN keyspace browsing & FLUSHALL/FLUSHDB/KEYS approval gate.
URI parsing, T-SQL identifier quoting, dialect schema modeling & TCP/SSH tunnel connectivity probes.
Oracle dialect modeling, constraint validation, URI parsing & connectivity probing.
Document URI parsing, NoSQL schema modeling & network/SSH tunnel probes.
Index endpoint URI parsing, search mapping dialect & connectivity probe.
CQL keyspace modeling, partition key hints & cluster node connectivity probe.
Production-Safe Perf Tuning & HMAC Dual-Gate Workflow
Every new profile defaults to EnvMode::Prod (read_only = true). Optimization happens strictly on linked zero-PII local DEV+TEST twins; PROD DDL/indexes only unlock after both stages verify and pass a 15-minute manual desktop grant.
Non-intrusive read-only inspection across pg_stat_statements (with pg_stat_activity fallback) & MySQL performance_schema: flags Seq Scan tables, dead-tuple bloat (n_dead_tup >= 15% & >= 1,000), stale ANALYZE counters, and Root Blocker lock trees.
clone_prod_to_local_twin strips 100% of PII rows and clones DDL, FKs & indexes to embedded SQLite/DuckDB or strictly loopback PG/MySQL (linked_prod_id). seed_tuning_data populates Uniform, HotspotZipf (80/20), or SkewedStatusTime up to 100,000 rows/table + auto ANALYZE (blocked on PROD).
Rewrites non-SARGable dates, arithmetic predicates, NOT IN -> NOT EXISTS, OR chains, deep OFFSET -> keyset cursors, and flags implicit casts/leading wildcards. Generates ESR (Equality->Sort->Range)+INCLUDE covering indexes + rollback DDL and benchmarks Before/After EXPLAIN timings & DiskSpill.
promotion_verifications.json stores HMAC-SHA256 hashes of normalized SQL across linked DEV & TEST runs. Any PROD DDL/index executes only with Allowed/AuthorizedSingleUse after BOTH DEV ✓ + TEST ✓ pass and a 15-minute desktop manual approval is consumed.
Honest Signals DBA Audit Rules
Every metric is grounded in real catalog or SQL anti-join telemetry. Timeouts, permission blocks, and un-analyzed tables surface explicitly instead of displaying fake zeros.
SQLite runs PRAGMA foreign_key_check with InterruptHandle timeout. PostgreSQL executes WHERE NOT EXISTS anti-joins with statement_timeout = 2500ms and skips synchronous scans when reltuples > 3,000,000—setting checked = false (Unchecked), never 0.
PostgreSQL inspects pg_stat_user_indexes.idx_scan; cold/un-analyzed tables with idx_scan == 0 report insufficient stats (zero score penalty, no false DROP INDEX). SQLite marks Unused only after UsageLedger samples >= 5.
Duplicate: same table, column order, uniqueness & partial predicate (non-PK). Redundant: non-unique, non-PK, non-partial index matching a strict leading prefix of a wider valid index. FK coverage checks leading columns case-insensitively.
Whenever any Severity::Critical finding exists, total health score is hard-capped at <= 74, relationship subscore at <= 68, and index subscore at <= 88.
MCP CLI Distribution, MCPB Bundles & Doctor
All MCP CLI subcommands support --json structured output for CI pipelines, repository onboarding, and host troubleshooting.
sqlstudio --mcpStart MCP server over STDIO for Cursor, Claude Code, Codex, and local agents.
sqlstudio --mcp-httpStart Streamable HTTP server on 127.0.0.1:15432/mcp with Bearer auth (OS Keychain / SQLSTUDIO_MCP_TOKEN).
sqlstudio mcp doctorAudits binary path, 18 client configs, repo secret leaks, HTTP auth/probe, in-process self-test, DB probes, audit logs & license tier.
sqlstudio mcp pack-mcpbPure-Rust MCPB v0.2 bundle builder packaging manifest, icon & optional binary with SHA-256 verification.
sqlstudio mcp install-projectInstall secretless repository-scoped MCP configs using ${SQLSTUDIO_MCP_TOKEN} placeholders.
sqlstudio mcp deeplinkGenerate 1-click Cursor and VS Code MCP installation deeplink URLs.
License CLI, sqlstudio:// Deep Links & Ed25519 Trust Root
Pure-safe Rust RFC 8032 Ed25519 offline tokens (SQLS1.<payload>.<sig>). The trusted public key is embedded exclusively at compile time via SQLSTUDIO_BUILD_LICENSE_PUBKEY. USD-only Creem orders display your License Key on /checkout/success with 1-Click "Activate in SQLStudio App" (sqlstudio://license/activate?key=...), and Pro Perpetual stays unlocked offline forever whenever BUILD_RELEASE_EPOCH <= updates_until.
sqlstudio://license/activate?key=<CREEM_KEY>ActivateKeyTriggered by 1-Click "Activate in SQLStudio App" on /checkout/success and /activate. Validates the Creem USD key via your locally configured Worker gateway and stores a signed SQLS1. token (also accepts sqlstudio://activate?key=...).
sqlstudio://license/import?token=<SQLS1...>ImportTokenImports an offline/air-gapped SQLS1.<payload>.<sig> token directly into the desktop workbench and verifies its RFC 8032 Ed25519 signature against the compile-time pubkey—zero network required.
sqlstudio://license/start-trialStartTrialImmediately initializes the 7-day Pro trial in SQLStudio (protected by an HMAC-SHA256 tamper-proof clock) with no credit card required.
sqlstudio://licenseOpenLicenseSettingsFocuses the running GPUI workbench and opens the License & Activation panel directly (alias: sqlstudio://open/license).
sqlstudio license statusInspect active license tier, status, machine fingerprint, trial countdown & embedded token claims.
sqlstudio license start-trialManually start a 7-day no-card Pro trial secured with HMAC-SHA256 clock-rollback protection.
sqlstudio license activateActivate a Creem key against the Cloudflare Worker gateway and store a signed SQLS1. Ed25519 token.
sqlstudio license importImport an offline/air-gapped SQLS1.<payload>.<sig> token and verify Ed25519 signature locally.
sqlstudio license open-url <url>Parse and execute an sqlstudio:// deep link (activate, import, start-trial, or license settings) from CLI or headless CI—ignoring untrusted gateway params while preserving literal + signs.
sqlstudio license register-protocolRegister or inspect OS url-scheme handling for sqlstudio:// (Windows HKCU reg.exe or macOS Info.plist / lsregister) with --dry-run inspection support.
sqlstudio license deactivateRelease device seat via gateway or clear local token (--local); trial history is never erased.
sqlstudio license keygenGenerate a fresh 32-byte (64-hex) Ed25519 signing seed and compile-time public key pair.
sqlstudio license signSign offline enterprise SQLS1. vouchers bound to tier, email, updates_until window & optional machine_fp.
Environment Variables & 8-Locale Reference
Powered by an atomic O(1) 8-locale engine. Use these environment variables to pin storage home, language, connection, tab, table, modal, or SQL autorun mode.
| Variable | Scope | Allowed / Example Values | Behavior |
|---|---|---|---|
| SQLSTUDIO_HOME | Runtime | /tmp/sqlstudio | D:\SQLStudioData | Overrides storage directory for config.toml, demo DB, encrypted vault & MCP audit logs. |
| SQLSTUDIO_LANG | Runtime | zh-CN | zh-TW | zh-SG | ja-JP | ko-KR | en-SG | en-US | en-GB | Pins one of the 8 regional locales across GUI and CLI (--lang <code> also supported). |
| SQLSTUDIO_CONNECTION | Runtime | demo-sqlite | pg-prod | Pre-selects a connection ID or name on workbench launch. |
| SQLSTUDIO_TAB | Runtime | overview | relationships | diagram | indexes | sql-lab | table | Opens a specific workbench tab immediately at startup. |
| SQLSTUDIO_TABLE | Runtime | orders | payments | Pre-selects a table when launching into table or diagram view. |
| SQLSTUDIO_MODAL | Runtime | ddl | Automatically opens a target modal (such as ddl) on startup. |
| SQLSTUDIO_QUERY | Runtime | "SELECT * FROM orders LIMIT 10;" | Pre-populates the SQL Lab editor buffer on startup. |
| SQLSTUDIO_AUTORUN | Runtime | run | explain | analyze | Automatically triggers run, explain, or analyze in SQL Lab on startup. |
| SQLSTUDIO_MCP_TOKEN | Runtime | sk-mcp-... | Bearer token fallback for Streamable HTTP MCP clients and `sqlstudio --mcp-http`. |
| SQLSTUDIO_BUILD_LICENSE_PUBKEY | Compile-Time | <64-char-hex> | Compile-time only (`option_env!`) 64-hex Ed25519 public key trust root; runtime env vars are never read. |