在左侧栏提供 SQL 分析与调优面板:按你粘贴的表结构解释查询、按风险排序给出优化建议,并生成建索引语句、SQL 改写与执行计划检查清单。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:jrc521/dsh-sql-tuner
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 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.
链接
同类插件
Tencent/WeKnora#dsh-weknora★ 38236
把 WeKnora 知识库接入 dsh 的四个只读工具:列出知识库、混合检索原文片段、按顺序还原单篇文档,以及直接取用 WeKnora 自己带引用的 RAG 或 ReAct agent 回答(含可续聊的 session id)。
DayuanJiang/next-ai-draw-io#dsh-plugin★ 37190
dsh 的 draw.io 绘图插件:通过 next-ai-drawio MCP 服务器作图,点回复里的链接在右侧栏打开实时预览,可以手动修改图,AI 的每次修改都是可以恢复的版本。需 Node.js 18+,首次使用由 npx 下载 MCP 服务器。
superdesigndev/treg★ 9111
给 Agent 的工具目录:按「要做的事」检索约 2,600 个外部接口(SEO 与 SERP、外链、社交、人物与公司信息补全、广告库、抓取),查看参数与单次调用价格后直接调用,凭据由服务端注入。附带技能,MCP 行在未设置 TREG_TOKEN 前保持禁用。
T-Auto/dsh-ops★ 6016
为 Windows 的 DSH 提供 bash、PowerShell 7 及 Rust 高性能工具,减少 token 消耗。
helloHub1212/dsh-windows-mcp★ 2563
通过官方 MCP 客户端桥接层把 CursorTouch/Windows-MCP 桌面自动化服务器接入 DSH,把截屏、UI 树快照、鼠标键盘输入、剪贴板、进程与注册表等工具注册成 mcp__windows__* 供模型调用,并附带 windows_mcp_doctor 诊断工具;Computer Use 默认关闭,需在插件面板里打开。
sixtysevenlf/dsh-blender-plugin★ 2280
让 DSH agent 通过直连 TCP 通道驱动本地 Blender,提供 15 个工具:视口帧、自定义视角渲染、Python 执行、无头与作业卸载、事务回滚,以及 34 个 family / 228 个 op 的规划层。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。