Long-running queries are one of the most common causes of SQL Server performance issues. When a query runs for an unusually long time, it can consume excessive CPU, memory, or IO resources and may also block other sessions.
In such situations, quickly identifying the problematic query becomes critical for DBAs. In this series of article on sp_WhoIsActive, we will explore how sp_WhoIsActive can help you to detect long-running queries and understand what they are doing inside SQL Server. Let's start.
[More]
When SQL Server performance sucks, "Just reboot it." is common phrase from one of my colleagues. And surprisingly, it often seems to fix the problem. However, the improvement is usually temporary. Restarting SQL Server clears the buffer cache, execution plan cache, and other diagnostic data, which can hide the real root cause. In this article, we will explore why rebooting appears to improve performance and why you should avoid this bad habit.
[More]
Recently, there was performance issue in one of our systems and the client asked us to find the root cause. In brief, there are two different processes in that system, some processes are generating some jobs and adding into a job table with unprocessed status, and other processes are competing to pick and update the unprocessed rows. Long time, the system was working fine without raising any concern. I was curious about what went wrong and how to fix it. So, I spent couple of hours to investigate it. In this article, I am going to explain what actually happened and how I resolved it. Let's start.
[More]
Monitoring real-time activity inside SQL Server is one of the most essential tasks for a DBA. Whether users are complaining about slow performance, reports are taking longer than usual, or your CPU suddenly spikes to 90%, the first question you ask yourself is — "What is running right now?". SQL Server offers several built-in tools such as Activity Monitor, sp_who2, and Dynamic Management Views (DMVs). During such critical moment, often these tools fall short to provide quick, accurate, and detailed insights.
To fill this gap, sp_WhoIsActive is emerged, which is opensource, lightweight, feature-rich, and incredibly efficient at showing what SQL Server is doing at any given moment. Thus, it becomes one of the most powerful diagnostic tools in a DBA’s toolkit.
In this series, I will cover installation, important output columns, diagnosing blocking, deadlocks, wait statistics, memory grants & TempDB usage, logging activity and advanced parameters. Let's start.
[More]
Memory grant is like a container for a query where it flourishes, sorts, joins and stores temporary result sets. Too small grant makes a query slow whereas too large suffers other queries. Understanding how SQL Server calculates memory grants, how to monitor them, and fix common issues are essential knowledge for every DBA. This guide breaks down the key concepts, shows how to identify problematic queries, and offers practical steps to troubleshoot and optimize memory grants in real workloads. Let's start.
[More]
Below query will reset the Index Usage, Wait Types, and Plan cache
[More]
WRITELOG is one of the common wait types found in the SQL Server. It is directly related to the speed and efficiency of writing transaction log stored in the file system. This ensures durability and data integrity. When WRITELOG waits are high, it usually indicates that SQL Server is spending too much time waiting for in-memory transaction log cache to be flushed to the transaction log file. This can slow down transactions and ripple across the entire workload. In this guide, we will explore what causes WRITELOG waits, how to identify the root bottlenecks, and practical ways to reduce their impact through configuration, hardware optimization, and workload tuning.
[More]
Execution Plan is like a blueprint. SQL Server uses it to execute a DML query. As a DBA, understanding execution plans is like reading the X-ray of query performance. It exposes where SQL Server spent its time and resources, which indexes used or ignored, and area of performance bottlenecks.
In this article, you will go through how to analyze SQL Server execution plans, interpret key operators, and identify optimization opportunities.
[More]
Did you ever face any scenario where you found no issues in CPU, memory, Disk IO or network, still some users are facing slow response and SQL Server has high ASYNC_NETWORK_IO wait type? At first glance, it may seem like SQL Server is the problem—but in reality, this wait type usually points outside the database engine. It occurs when SQL Server has results ready to send, but the client application (or the network in between) cannot consume the data fast enough. This may result-in query slowness, blocked sessions, and frustrated users.
In this article you will walk through what ASYNC_NETWORK_IO is when it occurs, simulate it and share some techniques to reduce them. Let's start.
[More]
Last page insert contention is common in a busy SQL Server environment where multiple users are inserting data simultaneously in a table and that table has clustered index on an identity column. When multiple sessions try to add data in the same data page file, the data page becomes "hotspot". As a result, processes queue up to acquire access to the last page, which leads to latch contention, high wait times, and overall reduced performance. Understanding why last page insert contention arises and its mitigation techniques are crucial for handling workloads with rapid inserts.
[More]