Adds a panel that explains a SQL query against a pasted schema, ranks optimization advice, and produces index DDL, SQL rewrites and an execution plan checklist.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:jrc521/dsh-sql-tuner
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
A DeepSeek Harness panel for reading and tuning SQL without touching a database.
Open SQL 调优 / SQL tuner from the left sidebar. The panel is split in two: the schema (and therefore index, partition, foreign-key and row-count context) on the left, the SQL under review on the right. Results refresh as you type.
What it does
Explanation — statement type, tables with aliases and row counts, join order, the projection, every predicate with an indexable / not indexable marker, grouping, ordering, paging, subqueries and set operations, followed by the logical execution order and an estimated access method per table.
Advice — rules run against your schema, each finding carrying a severity, the line it comes from, the concrete symptom, why it is slow, and how to fix it. About thirty checks including: function wrapped around an indexed column, leading-wildcard LIKE, implicit type conversion, NOT IN with a subquery, OR predicates, missing or non-covering indexes, range-before-equality index ordering, deep OFFSET paging, sorts that cannot use an index, correlated subqueries, cartesian products, LEFT JOIN degraded by WHERE, UPDATE/DELETE without WHERE, missing partition pruning, unindexed foreign keys.
Execution — ready-to-run index DDL for 14 dialects (CREATE INDEX CONCURRENTLY for PostgreSQL, ONLINE for Oracle, WITH (ONLINE = ON) for SQL Server, bitmap / minmax / inverted index notes for columnar engines), SQL rewrites (date ranges instead of functions on columns, keyset paging, NOT EXISTS, explicit projections, UNION ALL), a plan checklist for the chosen engine, and the session or optimizer settings commonly needed to verify the fix.
Input
- Schema — paste
CREATE TABLE/CREATE INDEX/ALTER TABLE ... ADD INDEX, or a plain data dictionary. Primary keys, foreign keys, partition keys, indexes and comments are detected. Row counts can be set per table in the parsed cards, or declared inline with-- rows: 12m(-- rows: 1200万also works). Extra indexes can be typed per table when they live outside the DDL. - SQL — type it, paste it, import a
.sql/.txtfile, or drop the file on the editor. Multiple statements separated by semicolons are analyzed individually (up to 8).
Interaction notes
- Results refresh as you type (260 ms debounce);
Ctrl+Enterre-runs the analysis immediately and confirms with a toast plus aHH:MM:SSstamp in the editor footer. - Each advice card carries an
L<n>chip; clicking it selects that line in the editor. 样例 / 清空ask for confirmation when the editor already holds content, and the toast reports what changed.- Copy buttons fall back to a selection based
execCommand('copy')when the clipboard API is denied. - Text stays in
localStorageunderdsh-sql-tuner.v1; the chip shows extra columns beyond the first 40 by count.
Limitations
- Analysis is rule-based and local. Row counts and scan estimates are heuristics derived from what you paste, not real
EXPLAINoutput — always confirm the final plan in the database. - It never connects to a database, never uploads SQL or schema, and makes no model request. State stays in the browser's
localStorage. - The parser understands common
SELECT/INSERT/UPDATE/DELETE/MERGEshapes including CTEs and subqueries; dialect-specific syntax outside those shapes may be parsed conservatively or skipped. - "Send to agent" only copies a formatted prompt and opens the conversation panel — it does not send anything by itself.
Files
engine.js— the analyzer; a pure function library with no I/O, shared by the Node tests and the browser bundle.src/client-src.js— the panel UI (React, no JSX) plus both locales.client.js— generated byscripts/build-client.mjs(inlines the engine into thewindow.__ModuleLoader__factory).test/engine.test.mjs— 62 assertions over parsing, rules, rewrites and every dialect.test/client.smoke.mjs— 48 assertions that load the built bundle with a tiny hooks runtime and render the whole panel in both languages.scripts/check-dict.mjs— asserts zh/en key parity and that every advice, explanation, plan and rewrite key used by the code exists.
Links
More in this category
Tencent/WeKnora#dsh-weknora★ 38236
Four read-only tools over a WeKnora knowledge base: list knowledge bases, hybrid passage search, reassemble one document's chunks in order, and WeKnora's own cited RAG or ReAct-agent answer with a resumable session id.
DayuanJiang/next-ai-draw-io#dsh-plugin★ 37190
Draws draw.io diagrams in DeepSeek Harness through the next-ai-drawio MCP server: the link in the reply opens a live preview in the right sidebar, you can edit the diagram by hand, and each AI change is a version you can restore. Node.js 18+; npx downloads the MCP server on first use.
superdesigndev/treg★ 9111
Tool catalog for agents: search ~2,600 external endpoints (SEO and SERP, backlinks, social, people and company enrichment, ad libraries, scraping) by the task you want done, read each one's parameters and per-call price, then call it with the credential injected server-side. Ships the skill plus an MCP row that stays disabled until TREG_TOKEN is set.
T-Auto/dsh-ops★ 6016
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
helloHub1212/dsh-windows-mcp★ 2563
Bridges the CursorTouch/Windows-MCP desktop automation server into DSH through the official MCP client bridge, registering its screenshot, UI tree snapshot, mouse and keyboard input, clipboard, process and registry tools as mcp__windows__* tools for the model, and adds a windows_mcp_doctor diagnostic tool. Computer Use is off by default and is switched on from the plugin panel.
sixtysevenlf/dsh-blender-plugin★ 2280
Lets a DSH agent drive a local Blender over a direct TCP channel with 15 tools: viewport frames, custom-angle renders, Python execution, headless and job offload, transaction rollback, and a planning layer of 228 ops across 34 families.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.