sql

Optimize SQL query performance and database indexing strategies.

25|3|Updated Jul 14, 2026
One-click install
npx skills add https://github.com/nimadorostkar/Claude-Skills-collection --skill sql-nimadorostkar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql
Source: https://github.com/nimadorostkar/Claude-Skills-collection/tree/main/skills/languages/sql
Command: npx skills add https://github.com/nimadorostkar/Claude-Skills-collection --skill sql-nimadorostkar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses inefficient database interactions by providing a structured approach to query optimization, indexing strategy, and execution plan analysis.

Core Features & Use Cases

  • Query Optimization: Provides techniques for writing efficient joins, CTEs, and window functions to reduce database load.
  • Performance Diagnostics: Guides the interpretation of EXPLAIN (ANALYZE, BUFFERS) output to identify bottlenecks like sequential scans or missing indexes.
  • Safe Schema Management: Offers best practices for migrations, such as using concurrent index builds to avoid production locking.

Quick Start

Analyze the provided SQL query and its execution plan to identify why the query is performing a sequential scan on the large orders table.

Frequently Asked Questions about sql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize SQL queries that are performing sequential scans on large tables?

To optimize SQL queries performing sequential scans, analyze the execution plan using EXPLAIN (ANALYZE, BUFFERS) to identify bottlenecks and apply proper indexing strategies to reduce database load. This approach targets missing indexes and inefficient joins, CTEs, or window functions.

What does EXPLAIN ANALYZE output tell me about database performance bottlenecks?

EXPLAIN ANALYZE output reveals query execution bottlenecks by showing the query planning steps, execution time, and buffer usage. Interpreting this output helps identify sequential scans, missing indexes, and inefficient join operations in relational database systems.

How do I build indexes concurrently without locking production tables?

To build indexes concurrently without locking production tables, use concurrent index build techniques during schema migrations. This safe schema management practice avoids production locking and ensures transaction isolation while updating database index structures.

When do I need transaction isolation management for database queries?

You need transaction isolation management when concurrent database queries cause lock contention or data anomalies in production environments. Applying lock-avoidance techniques and understanding database engine internals ensures safe, efficient query execution.

What is the best way to write efficient SQL joins and window functions?

The best way to write efficient SQL joins and window functions is to apply query optimization techniques that minimize database load. This involves structuring queries properly and leveraging database indexing strategies to improve execution plan performance.