Category: Performance Tuning
-
SQL Server Wait Types Library
Wait statistics are the single best first step in any SQL Server performance investigation. Every time a query waits on a resource, whether that’s a lock, disk I/O, a transaction log flush, a memory grant, or something else, SQL Server records it. By the time a performance problem appears, the evidence is usually already sitting…
Written by
-
How to Check Blocking SPIDs in SQL Server
Blocking is one of the most common causes of performance issues in SQL Server. When one session holds a lock on a resource and another session needs that same resource, the second session waits. If that wait persists, users experience slowness. Understanding how to quickly identify blocking SPIDs is a core DBA skill. This guide…
Written by
-
Script: Identify Long-Running Queries
This script returns currently executing queries ordered by elapsed time. It helps identify long-running requests that may be causing blocking, resource pressure, or user-facing delays. This is typically used during live performance incidents when users report slowness or when the instance appears busy. The Script Example Output The result set shows currently executing sessions ordered…
Written by
-
Script: Identify Missing Indexes
This script returns the highest-impact missing index recommendations based on cumulative workload statistics. It helps identify tables where SQL Server believes additional indexes could significantly improve query performance. This is useful during performance tuning, workload reviews, and when investigating high read activity or inefficient query plans. The Script Example Output The result set shows the…
Written by
-
Script: Check Index Fragmentation Across All Databases
This script checks index fragmentation levels across all online databases on the instance. It helps identify heavily fragmented indexes that may require maintenance. This is useful when reviewing index health, validating maintenance jobs, or troubleshooting performance issues related to inefficient index access. The Script Example Output The result set shows indexes across all user databases,…
Written by
-
Script: I/O Usage by Database
This script returns total read and write activity per database based on file-level I/O statistics. It helps identify which databases are generating the most disk activity on the instance. This is commonly used during performance troubleshooting, storage pressure investigations, and workload analysis. The Script Example Output The result set shows one row per database, including…
Written by
-
Script: Top Wait Statistics
This script returns the top wait types since the last SQL Server restart or wait statistics clear, excluding common idle and background waits. It provides a quick high-level view of where the instance is spending time. This is often the first script run during performance investigations to identify whether the primary pressure is related to…
Written by
-
Script: Check Worker Threads and Active Sessions
This script shows the current SQL Server worker thread count along with all active sessions and requests. It provides a live view of CPU usage, blocking, waits, running commands, and transaction activity. This is a practical script for performance troubleshooting when an instance appears busy, unresponsive, or under pressure. The Script Example Output The first…
Written by
Blog Categories
- Backups & Recovery (6)
- High Availability (HA) (5)
- Installation & Configuration (12)
- Labs (1)
- Maintenance (2)
- Monitoring (20)
- Performance Tuning (8)
- Security (Encryption & Permissions) (5)
- T-SQL Fundamentals (8)
- Troubleshooting (6)
- Wait Types (201)
Latest Posts
- SQL Server Wait Types Library
- PARALLEL_REDO_WORKER_SYNC Wait Type in SQL Server
- PARALLEL_REDO_WORKER_WAIT_WORK Wait Type in SQL Server
- PERFORMANCE_COUNTERS_RWLOCK Wait Type in SQL Server
- PREEMPTIVE_COM Wait Types in SQL Server
- PREEMPTIVE_DTC Wait Types in SQL Server
Blog Tags
Always On Availability Groups (4) Certificates & Encryption (1) Database Backups & Recovery (10) Database Maintenance (6) DBA Tools (29) Performance Troubleshooting (9) PowerShell (4) Query Behaviour (4) Schema Changes (1) SQL Agent (1) SQL Interview Questions (1) SQL Scripts (23) SQL Server Administration (11) SQL Server Configuration (7) SQL Server Errors (5) SQL Server High Availability (4) SQL Server Internals (4) SQL Server Management Studio (SSMS) (7) SQL Server Monitoring (10) SQL Server Networking (9) SQL Server Replication (1) SQL Server Security (8) SQL Server Versions (2) Storage and Capacity (14) T-SQL (9) Transaction Logs (8) Troubleshooting (14) Windows Server (4)