Skip to content
| Marketplace
Sign in
Visual Studio Code>Data Science>OptiSQL TunerNew to Visual Studio Code? Get it now.
OptiSQL Tuner

OptiSQL Tuner

OptiSQL by Shubham Singh

| (0) | Free
SQL performance-tuning AI agent that diagnoses slow queries, applies a fix on a copy, and proves the speed-up with before/after benchmarks.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

⚡ OptiSQL — VS Code Extension

SQL performance-tuning AI agent, directly in your editor. Paste a slow SQL query, and OptiSQL diagnoses the bottleneck, applies a fix on a copy of the database, and proves the speed-up with real before/after timings — then explains it in plain English.

Built on the OptiSQL SQL Performance-Tuning AI Agent project.

Open VSX Install ID


Features

  • 🔍 Diagnose — reads the schema and runs EXPLAIN QUERY PLAN to find full table scans.
  • 🛠️ Fix — adds an index or rewrites the query, on a copy of the database (the original is never modified).
  • 📊 Prove — benchmarks the query before and after and shows the speed-up.
  • 🗣️ Explain — every report ends with a "What I changed, explained simply" section written for a beginner.
  • 💬 GitHub Copilot — invoke via the /optisql slash command or let the model call OptiSQL as a tool.

Repository & language metadata

  • Publisher: shubh835780
  • Author: Shubham Singh
  • VS Code Marketplace ID: shubh835780.optisql-tuner
  • Open VSX ID: shubh835780.optisql
  • Version: 0.1.4
  • Engine: VS Code ^1.90.0
  • Homepage / repo: https://github.com/shubh835780/OptiSQL

Requirements

  • VS Code 1.90.0+
  • A Python 3.11+ interpreter on your machine (the extension depends on the Python extension for discovery — it auto-installs a virtualenv and dependencies for you on first run, so you never type a pip command).
  • An Anthropic API key (sk-ant-...) from https://console.anthropic.com/

Install

Option A — from the VS Code Marketplace (Microsoft)

  1. In VS Code, open the Extensions view (Ctrl+Shift+X).
  2. Search for "OptiSQL Tuner" → click Install. (Extension ID: shubh835780.optisql-tuner)
  3. Run OptiSQL: Set Anthropic API key (Ctrl+Shift+P) and paste your key.

Marketplace page: https://marketplace.visualstudio.com/items?itemName=shubh835780.optisql-tuner

Option B — from the Open VSX marketplace

  1. In VS Code, open the Extensions view (Ctrl+Shift+X).
  2. Search for "OptiSQL" → click Install. (Extension ID: shubh835780.optisql)
  3. Run OptiSQL: Set Anthropic API key (Ctrl+Shift+P) and paste your key.

Marketplace page: https://open-vsx.org/extension/shubh835780/optisql

Option C — from a .vsix file

  1. Download optisql-tuner-0.1.4.vsix from the GitHub Releases (or build it — see below).
  2. In VS Code, open the Extensions view (Ctrl+Shift+X).
  3. Click the ⋯ menu → Install from VSIX… → select optisql-tuner-0.1.4.vsix.
  4. Reload VS Code.
  5. Run OptiSQL: Set Anthropic API key (Ctrl+Shift+P) and paste your key.

Your API key is stored in VS Code's secure secret storage — never written to disk in plaintext.

Usage

Panel (recommended)

  • Run OptiSQL: Open report panel.
  • Pick an example slow query or click Generate demo DB, then paste a query.
  • Click ⚡ Tune. The agent runs and renders its report in the panel.

From the editor

  • Open a .sql file, select a query, right-click → OptiSQL: Tune a SQL query.

GitHub Copilot

  • In Copilot Chat, start with /optisql and mention a slow query. OptiSQL runs and streams the report into the chat.
  • Or just ask Copilot to "make this query faster" with a SQL file selected — the model can call OptiSQL as a language model tool.

Example slow queries

-- Missing index on orders.customer_id (full scan on 1M rows)
SELECT * FROM orders WHERE customer_id = 12345;

-- Missing index on orders.status
SELECT COUNT(*) FROM orders WHERE status = 'pending';

Demo database

The agent works against a synthetic 1M-row e-commerce database. Run OptiSQL: Generate demo database once; the panel then has a real, safely unindexed database to tune. No real customer data — everything is generated.

Settings

Setting Default Description
optisql.backend direct Agent backend: direct (Anthropic API) or langchain.
optisql.defaultQuery SELECT * FROM orders WHERE customer_id = 12345; Query the panel pre-fills.
optisql.rows 100000 Orders to generate for the demo DB.

Safety & integrity

  • The agent is read-only: it can never DROP / DELETE / UPDATE / INSERT / ALTER on your real data.
  • The single write action (create_index) operates on a copy of the database.
  • The agent loop has a hard iteration cap.
  • Signed build integrity. Every build ships an Ed25519-signed manifest (agent/integrity.json) covering the bundled Python agent files. On activation the extension re-hashes those files and verifies the signature against the publisher's pinned public key. If any file was changed, or the whole build was re-signed by someone other than the publisher (an impersonated or repackaged copy), the extension refuses to run the agent and explains exactly why. This makes tampering or a spoofed extension detectable and provable — not blocked by the marketplace alone.

Build from source

cd vscode-extension
npm install
npm run compile        # tsc -p ./

# Sign the bundled agent runtime with your Ed25519 private key, then package.
# Set OPTISQL_SIGNING_KEY (or pass --key path/to/private.pem) to sign.
npm run package        # sign + vsce package -> optisql-tuner-0.1.4.vsix

The signing key is yours to keep. Run node scripts/sign-agent.mjs --key your-private.pem (or set OPTISQL_SIGNING_KEY) before packaging. The private key is never committed or shipped — only the public key is pinned in src/integrity.ts. If you don't sign, the extension still builds but will report "unsigned" on activation and refuse to run the agent.

Repository layout

vscode-extension/
├── package.json       # manifest: commands, panel, Copilot participant + tool
├── tsconfig.json
├── src/               # TypeScript extension source
│   ├── extension.ts   # activate() wiring + commands
│   ├── pythonEnv.ts   # first-run venv bootstrap
│   ├── agent.ts       # spawns the Python agent, streams output
│   ├── panel.ts       # webview UI
│   ├── copilot.ts     # /optisql slash command + language model tool
│   └── secrets.ts     # API key storage
└── agent/             # bundled Python runtime (the OptiSQL agent)
    ├── agent.py
    ├── tools.py
    ├── db.py
    ├── make_data.py
    └── requirements.txt

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft