index-strategies

Design and maintain SQL Server indexes with CREATE INDEX examples and monitoring queries.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/moughamir/justwaitit-review --skill index-strategies-moughamir
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: index-strategies
Source: https://github.com/moughamir/justwaitit-review/tree/main/.agents/skills/index-strategies
Command: npx skills add https://github.com/moughamir/justwaitit-review --skill index-strategies-moughamir

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you design and optimize SQL Server indexes so your queries run faster and maintenance stays manageable, avoiding common mistakes like poor key choices, missing covering indexes, and inefficient fragmentation handling.

Core Features & Use Cases

  • Index Type Selection: Choose between clustered, nonclustered, columnstore, filtered, and covering indexes based on query patterns and workload goals.
  • Practical Index Design Patterns: Build composite keys with correct left-to-right matching, create INCLUDE-based covering indexes, and design filtered indexes with safe filter constraints.
  • Maintenance & Performance Monitoring: Apply fragmentation thresholds for REORGANIZE vs REBUILD, update statistics correctly, and use DM views to inspect index usage and identify missing index opportunities.
  • Columnstore Guidance: Recommend clustered and nonclustered columnstore approaches for analytics/aggregation workloads, including SQL 2022 ordered columnstore patterns.

Quick Start

Use the index-strategies skill when you want help deciding which SQL Server index type to create for a specific query and what exact CREATE INDEX statement structure to use.

Frequently Asked Questions about index-strategies

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

FAQPage Schema
When should I use a filtered index instead of a regular nonclustered index?

Use a filtered index when queries target a specific subset of rows, such as active records or non-null values. This Skill helps design filtered indexes with safe WHERE clause constraints to reduce storage size and improve query efficiency.

What is the best way to maintain SQL Server index fragmentation and update statistics?

The best way to maintain SQL Server index fragmentation is applying REORGANIZE for moderate fragmentation thresholds and REBUILD for severe fragmentation, followed by updating statistics. This Skill provides monitoring queries using dynamic management views to identify maintenance needs.

How do I choose between clustered and nonclustered columnstore indexes for analytics workloads?

Choose clustered columnstore indexes for large data warehousing fact tables without rowstore dependencies, and nonclustered columnstore for analytical queries on existing rowstore tables. This Skill recommends the appropriate columnstore approach for your aggregation workloads.

Why is my composite index not being used by SQL Server queries?

A composite index is not used when query predicates do not match the left-to-right column ordering of the index keys. This Skill helps build composite keys with correct left-to-right matching to ensure SQL Server query optimizer utilizes them.

Can I find missing index opportunities using SQL Server dynamic management views?

Yes, you can find missing index opportunities using SQL Server dynamic management views like sys.dm_db_missing_index_details. This Skill provides DM view monitoring queries to inspect index usage and identify actionable missing index recommendations.