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.