sqlserver-query-patterns

Community

Speed up SQL Server queries and indexing

AuthoriamBrzDev
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Slow queries, inefficient indexing, and poorly written stored procedures cause high resource usage, long response times, and unreliable reporting in SQL Server and Azure SQL environments. This Skill provides a pragmatic, checklist-driven approach to identify bottlenecks, remove common anti-patterns (for example SELECT *, non-sargable filters, cursors, and NOLOCK misuse), and recommend indexing and query refactors to restore predictable performance.

Core Features & Use Cases

  • Index strategy and maintenance guidance including when to rebuild vs reorganize and how to create covering or filtered indexes to eliminate key lookups.
  • Query and stored procedure refactoring patterns: set-based replacements for cursors, pagination with OFFSET/FETCH, CTEs for aggregation, and templates for robust procedures.
  • Diagnostics and tooling: how to read estimated and actual execution plans, identify operators with high cost, and use DMVs to find missing or unused indexes.
  • Use Case: Troubleshoot a slow reporting stored procedure that scans a large orders table, propose index changes, and provide a refactored query that supports pagination and a total-count window function.

Quick Start

Analyze the slow stored procedure usp_GetOrdersByCustomer, identify query plan bottlenecks, recommend index and schema adjustments, and produce a refactored T-SQL query with pagination and safety checks.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: sqlserver-query-patterns
Download link: https://github.com/iamBrzDev/enterprise-agent-skills/archive/main.zip#sqlserver-query-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.