sql-server-optimizer

Analyze and optimize SQL Server T-SQL queries, execution plans, and indexes with measured evidence.

4|2|Updated Sep 1, 2026
One-click install
npx skills add https://github.com/Procesio-Externals/procesio-cli --skill sql-server-optimizer-procesio-externals
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sql-server-optimizer
Source: https://github.com/Procesio-Externals/procesio-cli/tree/main/skills/sql-server-optimizer
Command: npx skills add https://github.com/Procesio-Externals/procesio-cli --skill sql-server-optimizer-procesio-externals

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Slow SQL Server queries and procedures are often "fixed" with guesses—blanket NOLOCK hints, reflexive RECOMPILE, or speculative indexes—that either fail or silently break correctness. This Skill enforces an evidence-driven optimization workflow: define correctness, capture a baseline plan and statistics, change one lever, re-measure, and verify semantics before claiming any improvement. ## Core Features & Use Cases - Evidence-based T-SQL optimization: Analyze execution plans, logical reads, parameter sniffing, implicit conversions, sargability, blocking, and index strategy, then propose the smallest defensible change with before/after metrics. - PROCESIO SQL action support: Review SQL inside PROCESIO Execute Query or Execute Command actions and migrate unsafe inline <%Variable%> substitution to native typed @parameter mappings with a full mapping table. - Guarded database context collection: Bounded metadata gathering via a registered sqlserver tool, plus legacy inspection-only exporter scripts (tables, indexes, procedures/functions) gated behind explicit scope and confidentiality approval. - Use Case: A query is fast for one customer and slow for another. The Skill treats parameter sensitivity as a hypothesis, requests actual plans and representative parameter values, proposes one rewrite or index, and requires comparable before/after measurements across both parameter shapes. ## Quick Start Ask the assistant to analyze and optimize your slow SQL Server query or stored procedure, providing the query text, execution plan, and table/index definitions if available.

Frequently Asked Questions about sql-server-optimizer

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

FAQPage Schema
How do I optimize a slow SQL Server query with execution plans?▼

Capture an actual execution plan plus SET STATISTICS IO, TIME ON with representative parameters, identify the dominant bottleneck such as a non-sargable predicate or cardinality error, change one lever, then re-measure logical reads, CPU, and elapsed time under the same conditions.

How to fix parameter sniffing in SQL Server stored procedures?▼

Treat parameter sensitivity as a hypothesis to test, not a diagnosis. Compare actual plans and metrics across representative fast and slow parameter values, check data distribution and statistics, and avoid reflexive RECOMPILE hints or local-variable masking without measured evidence.

Can this skill optimize PostgreSQL or MySQL queries?▼

No. The skill is scoped strictly to SQL Server T-SQL and explicitly excludes PostgreSQL, MySQL, and Oracle. Its rules for execution plans, indexes, and isolation are SQL Server-specific and should not be applied to other database engines.

Why is adding NOLOCK to every table a bad performance fix?▼

NOLOCK and READ UNCOMMITTED permit dirty and internally inconsistent reads, trading correctness for weaker observations without solving the underlying access-path or blocking design. The skill rejects blanket dirty reads and requires measured blocking evidence plus a correctness-preserving alternative.

How do I safely parameterize SQL in PROCESIO Execute Query actions?▼

Replace inline <%Variable%> tokens with native @parameter placeholders and configure the action's typed parameter mapping for each one. Wrapping an inline token in a DECLARE statement is still text substitution and does not remove injection or typing risk.

What evidence is needed before proposing a new SQL Server index?▼

An index proposal needs exact key order with rationale, included columns, optional filter semantics, overlapping existing indexes, expected read benefit, write and maintenance cost, and a before/after measurement plan. Selectivity must come from data distribution, not column names.