query-optimization

Diagnose and resolve slow T-SQL queries for SQL Server and Azure SQL Database.

51|10|Updated Oct 22, 2025
One-click install
npx skills add https://github.com/JosiahSiegel/claude-plugin-marketplace --skill query-optimization-josiahsiegel
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-optimization
Source: https://github.com/JosiahSiegel/claude-plugin-marketplace/tree/main/plugins/tsql-master/skills/query-optimization
Command: npx skills add https://github.com/JosiahSiegel/claude-plugin-marketplace --skill query-optimization-josiahsiegel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps diagnose and resolve slow-running T-SQL queries, reducing database load and improving application responsiveness.

Core Features & Use Cases

  • SARGability Analysis: Identifies and corrects non-SARGable query patterns that prevent index usage.
  • Parameter Sniffing Solutions: Provides strategies to mitigate performance degradation caused by parameter sniffing.
  • Execution Plan Interpretation: Guides users on analyzing execution plans to pinpoint bottlenecks.
  • Statistics Management: Offers advice on maintaining up-to-date statistics for accurate query planning.
  • Use Case: A user reports that a critical report is taking too long to load. This Skill can analyze the T-SQL query, identify that a function is being applied to a column in the WHERE clause (making it non-SARGable), and suggest rewriting it to use an index seek.

Quick Start

Analyze the following T-SQL query for performance bottlenecks and suggest optimizations: [Paste your T-SQL query here].

Frequently Asked Questions about query-optimization

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

FAQPage Schema
How do I optimize slow-running T-SQL queries in SQL Server?

Optimize slow T-SQL queries by analyzing execution plans to pinpoint bottlenecks, correcting non-SARGable WHERE clauses, managing statistics, and applying index tuning or query hints to reduce database load.

What is SARGability and how does it affect SQL Server query performance?

SARGability determines whether a query can use index seeks. Applying functions to columns in WHERE clauses creates non-SARGable patterns that prevent index usage, requiring query rewrites to restore efficient index seeks.

How do I fix parameter sniffing issues in Azure SQL Database?

Fix parameter sniffing in Azure SQL Database by implementing query hints or rewriting procedures to mitigate performance degradation caused by execution plan caching with atypical parameter values.

How do I analyze an execution plan to find T-SQL performance bottlenecks?

Analyze execution plans to find T-SQL performance bottlenecks by identifying expensive operators, detecting implicit conversions causing scans, and checking if outdated statistics are leading to inefficient query planning.

Can I use query hints to tune T-SQL performance in Azure SQL?

Yes, you can use query hints to tune T-SQL performance in Azure SQL by forcing specific join types or index usage, overriding the optimizer to resolve parameter sniffing and execution plan regression issues.

Why does my SQL Server query ignore indexes and perform a table scan?

SQL Server queries ignore indexes and perform scans due to non-SARGable predicates, implicit data type conversions, or outdated statistics. Correcting query syntax and maintaining statistics enables index seeks.