本文へスキップ
Skillpedia
一般的なプログラミング48k · #5845

sql-optimization-patterns

できること

このツールは、データベースのクエリを遅くしている問題を見つけて直すのに役立ちます。データベースがコマンドをどのように実行しているかを分析し、インデックスの追加やクエリの書き換えなどの改善案を提案して、全体をより速く動かせるようにします。

使う場面

  • ✓データベースのクエリの応答に時間がかかりすぎているとき。
  • ✓パフォーマンスを高めるために、データベースの構造を設計または調整するとき。
  • ✓データベースに負荷がかかっている理由と、その負荷を減らす方法を理解したいとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/sql-optimization-patterns/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/sql-optimization-patterns/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“ユーザーを取得するSQLクエリがとても遅いので、最適化を手伝ってもらえますか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、クエリの「実行計画」を分析します。実行計画とは、データベースがそのコマンドをどのように実行するかを決めた手順のことです。その分析をもとに、インデックスの追加やクエリの書き換えなどの変更を提案し、より効率的な形にします。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

SQL Optimization Patterns

Diagnose slow SQL with query plans, preserve query results, and verify indexing or query changes against representative data.

Use this skill when

  • Debugging slow-running queries
  • Designing performant database schemas
  • Optimizing application response times
  • Reducing database load and costs
  • Improving scalability for growing datasets
  • Analyzing EXPLAIN query plans
  • Implementing efficient indexes
  • Resolving N+1 query problems

Do not use this skill when

  • The task is unrelated to sql optimization patterns
  • You need a different domain or tool outside this scope

Instructions

  • Confirm database engine/version, query parameters, expected rows, data distribution and the permitted environment. Start read-only; obtain authorization before DDL, data changes, configuration changes or maintenance.
  • Compare result sets before comparing performance. EXPLAIN ANALYZE executes the statement: use approved representative data, account for functions and triggers, and do not assume a transaction rollback undoes every side effect.
  • Record the observed plan, timing conditions and correctness checks. Indexes and query rewrites are hypotheses, not universal speed improvements.
  • If detailed examples are required, open resources/implementation-playbook.md.

Resources

  • resources/implementation-playbook.md for detailed patterns and examples.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Worked example

The playbook includes an executable SQLite batch-loading example with bound values and an empty-input case. The repository test exercises it alongside pagination ties and aggregation equivalence. SQLite correctness checks do not establish PostgreSQL performance or production safety.

よくある質問

「実行計画」とは何ですか?

データベースが、要求されたデータを探して返すために選んだ経路のことです。これを分析すると、どこがボトルネックになっているかが分かります。

「インデックス」とは何ですか?

本の索引のようなものです。すべてを読まなくても、データベースが特定の情報を素早く見つけられるようにします。

このツールがデータベースを直接変更することはありますか?

直接変更することはありません。変更案を提示し、変更を加える前に必ずあなたの許可を求めます。最初は読み取りだけの分析から始めます。

詳細

作者による元の説明

Diagnose slow SQL with query plans, preserve query results, and verify indexing or query changes against representative data.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5845
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル