Query Optimization (Grade A) logo

Query Optimization (Grade A)Security-tested development skill for Claude AI. Grade A. Workflow for identifying and fixing slow database queries. Use when a query is slow or the user asks to optimize database performance.

(0)
Daniel NikulshynReviewed by Daniel Nikulshyn·Updated July 2026

Overview

Workflow for identifying and fixing slow database queries. To optimize database performance, the skill involves the following steps: Step 1: Identify Slow Query Get the query text Measure current execution time Check query frequency (how often it runs) Step 2: Analyze Query Plan Run EXPLAIN ANALYZE on the query Identify sequential scans on large tables Check for missing indexes Look for unnecessary joins or subqueries Check sort operations (external sorts) Step 3: Optimize Common optimizations include: Add missing indexes Rewrite subqueries as JOINs Add WHERE clause filters to reduce data Use cursor-based pagination instead of OFFSET Add partial indexes for filtered queries Denormalize if read performance is critical Step 4: Benchmark Run optimized query with EXPLAIN ANALYZE Compare before/after execution times Test with production-like data volume Verify results are identical Step 5: Implement Update query in code Create migration for new indexes Add monitoring for the query Update any affected tests This results in a query optimized with measurable improvement and monitoring in place when applied according to this workflow.

Key features

  • Query analysis using EXPLAIN ANALYZE
  • Identification of sequential scans, missing indexes, and unnecessary joins
  • Optimization techniques such as adding indexes, rewriting subqueries, and denormalization
  • Benchmarking and testing of optimized queries

Pricing

Model
Free
Category
Skills
Rating
No reviews yet

Use cases

Optimizing a Slow Query

Use Query Optimization (Grade A) when a database query is slow and impacting application performance. The workflow helps identify the root cause of the slow query and provides a structured approach to optimizing it.

Improving Database Performance

Use Query Optimization (Grade A) when a user requests to optimize database performance. The workflow helps identify and fix slow queries, reducing the overall load on the database and improving performance.

Pros & Cons

Pros

  • Improves database query performance
  • Reduces query execution time
  • Provides a structured approach to query optimization

Cons

  • Requires knowledge of database query analysis and optimization techniques
  • May require changes to existing code and database schema

Reviews

Sign in to leave a review.

No reviews yet. Be the first!

Q&A

How does the skill benchmark performance after optimization?

After applying changes, it runs EXPLAIN ANALYZE on the modified query, comparing execution times and plan details to the original to verify improvement.

Asked by Stella Papadopoulos · Dec 4, 2025

What are the main limitations of using this tool?

The skill assumes the user has knowledge of database query analysis and can make schema changes. It requires access to run EXPLAIN ANALYZE and may need code changes to implement optimizations.

Asked by Yuki Kobayashi · Oct 24, 2025

Which optimization techniques are supported by this skill?

It can add missing or partial indexes, rewrite subqueries as JOINs, filter data with WHERE clauses, replace OFFSET with cursor-based pagination, and even denormalize tables when read performance is critical.

Asked by Kenji Watanabe · Sep 30, 2025

What steps does the Query Optimization skill follow to improve slow queries?

The workflow starts with identifying the slow query, measuring its execution time and frequency. Then it runs EXPLAIN ANALYZE to analyze the query plan, spotting sequential scans, missing indexes, and unnecessary joins. Finally, it applies optimizations such as adding indexes, rewriting subqueries, or using pagination, and benchmarks the result with EXPLAIN ANALYZE again.

Asked by Grzegorz Lewandowski · Sep 8, 2025

Ask a question

Skills alternatives

Manage Headers (Grade A) logo
Manage Headers (Grade A)Skills

Security-tested development skill for Claude AI. Grade A. Inspects and configures the security headers a Power Pages site sends to browsers — Content Security Policy, frame and clickjacking protection

(0)
Free
Using Git Worktrees (Grade A) logo
Using Git Worktrees (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktre

(0)
Free
Ga4 Bigquery Schema (Grade A) logo
Ga4 Bigquery Schema (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. GA4 BigQuery Export Schema Reference — complete field reference, nested structures, query patterns, and performance tips

(0)
Free
Meta Capi (Grade A) logo
Meta Capi (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. Meta Conversions API (CAPI) Setup Reference — architecture, event types, customer information hashing, deduplication, implementation examples, AEM

(0)
Free
Callees (Grade A) logo
Callees (Grade A)Skills

Security-tested development skill for Claude AI. Grade A. Lista o que uma funcao/metodo chama (call graph direto)

(0)
Free
Test Module Name (Grade A) logo
Test Module Name (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. Name Haskell test modules after the module under test with a Spec suffix in the same namespace. Use when writing or reviewing Haskell test module

(0)
Free
Board Of Directors (Grade A) logo
Board Of Directors (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. Simulate a 5-member expert board deliberation for major decisions. Use when evaluating plans, architecture choices, feature designs, or any decisi

(0)
Free
Advpl Mvc Avancado (Grade A) logo
Advpl Mvc Avancado (Grade A)Skills

Security-tested development skill for Claude AI. Grade A. MVC avançado via PE (Pontos de Entrada) — adicionar grids customizadas em telas MVC padrão (CNTA300/MATA070/MATA440/MATA460/FINA040 via *STRU)

(0)
Free