Token导航 LogoToken导航

Agent Skill · 运维

sql-optimization(SQL optimization 测试)

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

sql-optimization 是运维类 Agent Skill,可用宿主为 OpenClaw,通过ClawHub获取,权限为权限未标注;许可证为 MIT-0,第三方扫描已通过,按安装量在运维类的 954 个 Skill 里排第 518。

总安装 6,650周安装 269GitHub Stars 公开资料未说明下载 2,087核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT-0
版本
1.0.0

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sql-optimization(SQL optimization 测试)
来源仓库:https://github.com/codekungfu/sql-optimization
安装命令:
openclaw skills install sql-optimization
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install sql-optimization

这个 Skill 是做什么的

运维类 Skill 处理部署、监控、日志和云资源,多数需要较高的执行权限。

sql-optimization 辅助数据库查询分析与性能调优,支持索引策略建议。适合让 Agent 编写 SQL、排查慢查询或生成迁移脚本时使用。通过 clawhub 安装,需明确数据库类型与连接环境后再执行操作。涉及数据变更时应优先 dry-run 或事务保护,避免误删误改。

适用于 OLTP 或数据分析系统中的 SQL 性能瓶颈处理。

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 OpenClaw;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 openclaw skills install sql-optimization;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    权限没有明确标注,第一次使用时只给一个无关紧要的任务,观察它到底读了哪些文件和网络。

常见问题

6 条

sql-optimization 怎么安装?

在终端执行 openclaw skills install sql-optimization。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

sql-optimization 支持哪些 AI 工具?

公开资料标注支持 OpenClaw。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

sql-optimization 需要什么权限?

权限级别没有明确标注。第一次使用时建议只给无关紧要的任务,观察它实际读写了哪些内容。

sql-optimization 是免费的吗?

来源标注的许可证是 MIT-0。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

sql-optimization 用的人多吗?

公开数据是累计安装 6,650 次,近一周安装 269 次,下载 2,087 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

sql-optimization 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 专注 OpenClaw 一种宿主,触发方式和使用习惯不用来回切换。
  • 许可证明确为 MIT-0,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 OpenClaw,想直接扩展它能力的人。
  • 需要处理运维类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

运维类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
docker-essentials

Docker 基础 · OpenClaw

1,005,15130接触敏感数据MIT-0通过
playwright-scraper-skill

Playwright scraper 技能 · OpenClaw

923,55754接触敏感数据MIT-0有提醒
moltguard

moltguard 搜索 · OpenClaw

825,096110接触敏感数据MIT-0通过
finance-news

财经新闻 · OpenClaw

275,51210需要联网MIT-0有提醒
security-monitor

安全监视器 · OpenClaw

224,1695需要联网MIT-0有提醒
sql-optimization

SQL optimization 测试 · 本页

6,650—权限未标注MIT-0通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

name
sql-optimization
description
Deep SQL performance workflow—symptom framing, execution plans, indexing strategy, query rewrite, locking/transaction behavior, statistics, partitioning, and verification. Use when queries time out, DB CPU spikes, or migrations change access patterns.

SQL Optimization (Deep Workflow)

Optimization without measurement is guesswork. Structure the work as observe → explain (plan) → change → verify, with explicit attention to correctness, locks, and write amplification from indexes.

When to Offer This Workflow

Trigger conditions:

  • Slow queries, growing P95/P99, replication lag, lock waits
  • ORM-generated SQL surprises; N+1 at DB layer
  • Index explosion, bloat, or “we added indexes everywhere”

Initial offer:

Use six stages: (1) frame the problem, (2) reproduce & measure, (3) read execution plans, (4) schema & indexes, (5) query & transaction tuning, (6) verify & guardrail. Confirm engine (PostgreSQL, MySQL, SQL Server, etc.) and environment (prod-like data volume).


Stage 1: Frame the Problem

Goal: Define SLO, scope, and non-goals.

Questions

  1. Which queries or endpoints are slow? User-facing vs batch?
  2. Regression—did deploy, data volume, or stats change?
  3. Isolation level and consistency requirements—can we read replicas?
  4. Write risk: is this table write-heavy? Index cost?

Exit condition: One-line problem statement with metric (e.g., “p95 2.4s on /reports at 10k RPS”).


Stage 2: Reproduce & Measure

Goal: Stable repro with representative cardinality and parameters.

Actions

  • Capture exact SQL, parameters, and frequency
  • Use EXPLAIN (ANALYZE, BUFFERS) or equivalent—engine-specific
  • Check buffer cache effects: cold vs warm cache; run twice when needed
  • Compare prod stats vs staging—row counts, histograms

Pitfalls

  • Optimizing on empty dev DB
  • Different parameter sniffing values changing plan choice

Exit condition: Baseline numbers + plan hash or saved plan for A/B.


Stage 3: Read Execution Plans

Goal: Name the dominant cost: seq scan, bad join order, sort, hash spill, nested loop explosion.

Interpret (adapt to engine)

  • Seq scan on large tables—filter selectivity? missing index? stats?
  • Index scan vs bitmap vs index only—covering indexes trade-offs
  • Joins: wrong order, missing stats, outdated NDV
  • Sort/hash spills to disk—work_mem / memory grants
  • Locks: FOR UPDATE, long transactions, hot row updates

Exit condition: Hypothesis tied to plan node(s), not generic “add index.”


Stage 4: Schema & Indexes

Goal: Right indexes for read paths without destroying writes.

Strategy

  • Composite index column order: equality → range; avoid redundant indexes
  • Partial indexes for hot subsets
  • Covering indexes vs table bloat—measure write cost
  • Foreign keys and constraints affecting plans
  • Statistics: ANALYZE, extended stats, histograms—when stale stats lie

Advanced (when relevant)

  • Partitioning for prune + maintenance
  • Materialized views / pre-aggregation for heavy reports

Exit condition: DDL proposal with rationale and rollback (drop index concurrently if supported).


Stage 5: Query & Transaction Tuning

Goal: Sometimes the fix is SQL rewrite, not hardware.

Techniques

  • Reduce rows touched early (CTEs vs inline—engine-dependent)
  • Pagination without OFFSET on huge pages (keyset)
  • Batch vs row-by-row; UNION ALL vs OR
  • N+1: batch queries, joins, data loader patterns
  • Transactions: shorten locks; avoid unnecessary SELECT FOR UPDATE
  • ORM: eager vs lazy loading discipline

Exit condition: New plan shows lower cost / measured latency; lock time acceptable.


Stage 6: Verify & Guardrail

Goal: Improvement holds under load and doesn’t regress neighbors.

Verify

  • Re-run EXPLAIN ANALYZE with production-like parameters
  • Load test or shadow traffic if available
  • Monitor: buffer hit ratio, index bloat, replication lag

Guardrails

  • Query timeouts and statement_timeout where safe
  • Alerts on sequential scans on large tables if observability supports

Final Review Checklist

  • [ ] Baseline and target metrics documented
  • [ ] Plan-based root cause, not guesswork
  • [ ] Index/DDL changes justified vs write load
  • [ ] Transaction/lock behavior considered
  • [ ] Verification on realistic data and load

Tips for Effective Guidance

  • Always mention parameter sniffing and stale statistics as frequent culprits.
  • Warn when adding indexes on very write-heavy tables without measuring bloat.
  • Prefer keyset pagination education for large lists.

Handling Deviations

  • No EXPLAIN access: infer from symptoms + ORM logs + index list; recommend safe staging repro.
  • Vendor DB: name that hints and features differ—avoid PostgreSQL-only advice on SQL Server without caveat.

平台分布

OpenClaw

81.52%
按下载量换算1,701

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

权限未标注

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills