Tag: Performance Troubleshooting

SQL Server performance troubleshooting scripts and techniques for identifying slow queries, waits, blocking, resource pressure, and execution issues.

  • Deleting Rows in Batches in SQL Server

    Deleting large volumes of data from a SQL Server table looks simple, but it can cause real problems if done carelessly. A single large DELETE can: When you’re cleaning up historical data or running routine maintenance, deleting rows in batches is usually the safest and most predictable approach. This post shows a simple, production-safe pattern…

  • 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…

  • Show Database Growth Events in SQL Server

    Database file growth events are easy to ignore until they become a problem. When a data or log file autogrows, SQL Server pauses briefly to extend the file. If this happens frequently, it can introduce latency, increase I/O pressure, and in some cases trigger disk space incidents. For DBAs, understanding when files grow and which…

  • 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…

  • 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…

  • Script: Check MAXDOP Configuration

    This script shows the current MAXDOP setting and helps you quickly validate whether it’s likely to be sensible for the server you’re connected to. It includes the configured MAXDOP value and core visibility information so you can make an informed call without digging through multiple places. The Script Example Output The first result set shows…