Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/sweetteabittersugar-query-optimization
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/query-optimization
What's inside
- Skill name
query-optimization- Description
- 查询优化指南 —— 慢查询分析、索引调优、执行计划解读与 N+1 问题治理
- License
- MIT
- Instructions
- 32 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- SKILL.md.disabled
SKILL.md (first lines)
# 查询优化指南 ## 概述 提供数据库查询性能优化的系统化方法论,覆盖从慢查询定位、执行计划分析、索引设计到 ORM N+1 问题的全链路优化。 ## 使用场景 - 线上数据库负载过高需要定位慢查询 - 接口响应时间异常需要排查 SQL 性能 - 索引设计评审和优化建议 - ORM 查询的 N+1 问题排查和修复 ## 核心原则 1. **先测量再优化**:没有执行计划(EXPLAIN)数据的优化是盲目的。永远基于指标而非直觉做决策。 2. **索引是最廉价的优化**:在查询频繁且过滤性好的列上建立索引,收益远高于代码层面的优化。 3. **减少数据传输量**:`SELECT *` 是性能杀手——只查需要的列;分页必须有合理的 LIMIT。 4. **避免循环查询(N+1)**:ORM 懒加载是 N+1 的主要来源。使用 JOIN 或批量预加载(`prefetch_related` / `eager loading`)替代。 5. **覆盖索引最大化**:如果索引包含查询所需的所有列,则无需回表查询,性能提升数倍。 ## 常见优化手段 - **执行计划分析**:关注 `type`(range > index > ALL)、`rows`(扫描行数)、`Extra`(Using filesort 是坏信号) - **联合索引**:遵循最左前缀原则,高选择性的列放左侧 - **分页优化**:大 offset 用游标分页或 `WHERE id > last_id LIMIT n` 替代 `OFFSET` - **查询重写**:子查询改 JOIN、OR 改 UNION、避免函数操作索引列 ## 检查清单 - [ ] 是否通过 EXPLAIN 分析了所有核心查询的执行计划? - [ ] 是否存在未使用索引的全表扫描(type=ALL)? - [ ] 是否存在 N+1 查询(ORM 循环加载关联数据)? - [ ] 分页查询是否有合理的 LIMIT 和索引支持? - [ ] 是否有慢查询日志的监控和告警机制?
From Sweetteabittersugar/agency, MIT.
More from Sweetteabittersugar/agency
- 0.555score
architecture-patterns
Sweetteabittersugar
架构设计模式参考 —— 常见架构风格的决策框架、优劣对比与适用场景
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
browser-compatibility
Sweetteabittersugar
浏览器兼容性检查 —— 目标浏览器覆盖率、特性支持度验证与降级策略
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
caching-strategy
Sweetteabittersugar
缓存策略参考 —— 多级缓存架构、失效策略、缓存穿透/击穿/雪崩防护
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
database-design
Sweetteabittersugar
数据库设计规范 —— 范式设计、索引策略、分库分表、命名约定与迁移管理
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
dependency-audit
Sweetteabittersugar
依赖审计方法论 —— CVE 扫描、许可证合规、版本锁定与升级策略
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
docker-patterns
Sweetteabittersugar
Docker 最佳实践 —— 多阶段构建、镜像层优化、安全运行、编排模式
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
e2e-testing
Sweetteabittersugar
端到端测试实战 —— 关键用户流程覆盖、测试数据管理、环境隔离与 Playwright/Cypress 最佳实践
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
error-handling-patterns
Sweetteabittersugar
错误处理模式 —— 异常分类体系、重试与降级策略、错误码规范与用户友好提示
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
health-check-patterns
Sweetteabittersugar
健康检查模式 —— 存活探针、就绪探针、依赖健康检查与服务健康度仪表板
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
microservices
Sweetteabittersugar
微服务架构模式 —— 服务拆分原则、通信模式、数据一致性与治理框架
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
parallel-execution
Sweetteabittersugar
并行执行方法论 —— 独立任务识别、并行策略、结果合并与冲突避免
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
rag-patterns
Sweetteabittersugar
RAG 模式 —— 检索增强生成架构设计、分块策略、向量检索优化与评估方法
SkillBFreshness: B★ 3Claude Code +9
Signals
- Stars
- 3
- Forks
- 1
- Open issues
- 0
- Last commit (this folder)
- Jun 10, 2026 (4 months ago)
- Last release
- Aug 24, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Sweetteabittersugar/agency
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Sweetteabittersugar
- 0.555score
architecture-patterns
Sweetteabittersugar
架构设计模式参考 —— 常见架构风格的决策框架、优劣对比与适用场景
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
browser-compatibility
Sweetteabittersugar
浏览器兼容性检查 —— 目标浏览器覆盖率、特性支持度验证与降级策略
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
caching-strategy
Sweetteabittersugar
缓存策略参考 —— 多级缓存架构、失效策略、缓存穿透/击穿/雪崩防护
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
database-design
Sweetteabittersugar
数据库设计规范 —— 范式设计、索引策略、分库分表、命名约定与迁移管理
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
dependency-audit
Sweetteabittersugar
依赖审计方法论 —— CVE 扫描、许可证合规、版本锁定与升级策略
SkillBFreshness: B★ 3Claude Code +9 - 0.555score
docker-patterns
Sweetteabittersugar
Docker 最佳实践 —— 多阶段构建、镜像层优化、安全运行、编排模式
SkillBFreshness: B★ 3Claude Code +9
Cite this page
query-optimization skill. Agent Mart. https://agentmart.dev/skills/sweetteabittersugar-query-optimization (last updated 2026-10-24)