<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wait Types - Techyaz.com</title>
	<atom:link href="https://techyaz.com/category/sql-server/wait-types/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Tips, Tutorials and How-to Topics</description>
	<lastBuildDate>Fri, 01 Jun 2018 12:30:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8</generator>

<image>
	<url>https://techyaz.com/wp-content/uploads/2017/11/cropped-Site-icon-150x150.png</url>
	<title>Wait Types - Techyaz.com</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Top 10 Performance Counters to Identify SQL Server Memory Pressure</title>
		<link>https://techyaz.com/sql-server/performance-tuning/top-10-performance-counters-to-identify-sql-server-memory-pressure/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/top-10-performance-counters-to-identify-sql-server-memory-pressure/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Mon, 30 Apr 2018 11:52:11 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Wait Types]]></category>
		<category><![CDATA[Memory Issues]]></category>
		<category><![CDATA[Perfmon Counters]]></category>
		<category><![CDATA[Perfmon Memory Counters]]></category>
		<category><![CDATA[performance tuning]]></category>
		<category><![CDATA[SQL_Server_Memory_Management]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=2196</guid>

					<description><![CDATA[<p>Memory is one of the important system resource that SQL Server uses to process their transactions. Sometimes, your server might face memory bottleneck that reduces the performance of running transactions. Here, I will explain top 10 performance counters to identify&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/top-10-performance-counters-to-identify-sql-server-memory-pressure/">Top 10 Performance Counters to Identify SQL Server Memory Pressure</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Memory is one of the important system resource that SQL Server uses to process their transactions. Sometimes, your server might face memory bottleneck that reduces the performance of running transactions. Here, I will explain top 10 performance counters to identify SQL Server memory pressure or memory bottleneck. If your system is facing insufficient system memory then i would recommend you to read below article.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/sql-server-error-701-there-is-insufficient-system-memory-to-run-this-query/" target="_blank" rel="noopener">Fix SQL Server Error 701: There is Insufficient System Memory to Run this Query</a></strong></li>
</ul>
<p>We can use Windows PerfMon utility to gather current values of all given performance counters. Just type <em>perfmon</em> in <em>run</em> prompt to launch perfmon tool to gather memory related performance counters. Although, Microsoft has also given a DMV related to performance counters that is very useful in collecting data and detecting CPU, IO or memory bottleneck in SQL Server. You can run below command to get all performance counters and their respective values using DMV <em>sys.dm_os_performance_counters</em>. You can also use this DMV to get performance counter values to identify memory pressure in SQL Server.</p>
<pre><strong><span style="color: #0000ff;">Select * from sys.dm_os_performance_counters</span></strong></pre>
<p>By default, SQL Server changes its memory requirements dynamically, on the basis of available system resources. I have explained SQL Server Memory Management and how SQL Server allocated memory to their transactions in below attached article.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/sql-server-memory-allocation-min-max-server-memory-configuration/" target="_blank" rel="noopener">SQL Server Memory Allocation &amp; Role of MIN/MAX Server Memory Configuration</a></strong></li>
</ul>
<h3><span style="color: #333399;">Performance Counters to Identify SQL Server Memory Pressure</span></h3>
<p>Let’s discuss top perfmon counters for memory usages to identify its bottleneck. Below is the list of top 10 performance counters to identify SQL Server Memory pressure. If you want to read CPU and Disk IO related perfmon counters then i would suggest you to read below attached articles.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/top-perfmon-counters-to-identify-sql-server-cpu-bottleneck/" target="_blank" rel="noopener">Top Perfmon Counters to Identify SQL Server CPU Bottleneck</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/identify-disk-bottleneck-using-perfmon-counters/" target="_blank" rel="noopener">Identify Disk Bottleneck in SQL Server using Perfmon Disk Counters</a></strong></li>
</ul>
<h5><span style="color: #993300;">Memory: Available Bytes</span></h5>
<p>First thing you should look at in case of memory bottleneck in SQL Server is the available memory that can be used by processes. You can get this value by looking at the counter <em>Available Bytes</em> under object <em>Memory</em>. Low value of this counter shows the memory shortage on this server.  Now, you should focus behind the reason of this memory shortage. There might be possibility that some of your applications running on your server are not releasing memory or your system has not enough memory to perform current workload that leads to the memory bottleneck in SQL Server.</p>
<h5><span style="color: #993300;">Memory: Pages/sec</span></h5>
<p>This counter indicates the total number of pages that are either read from disk or written to the disk due to page fault. When a process requests a data page that is not in memory then it will be retrieved from disk to memory. This process is known is page fault. High value of this counter could indicate the excessive paging. We should further monitor Memory: Page Faults/sec counter to go indepth information. The average <em>Pages/sec</em> value should be below 50. A high value of <em>Pages/sec</em> indicates intensive memory activities like read from and write to disk. It means transactions are getting enough memory that is why they are using disk to process their requests.</p>
<h5><span style="color: #993300;">Memory: Page Faults/sec</span></h5>
<p>High value of counter <em>Memory: Pages/sec</em> could indicate the excessive paging. Next, we should monitor the <em>Memory: Page Faults/sec</em> counter to make sure that the disk activity is not caused by paging. If you want to determine whether SQL Server or another process is causing excessive paging then we should monitor the <em>Process: Page Faults/sec</em> counter for the SQL Server process instance. This will give an exact picture whether SQL Server is causing this paging issue or not.</p>
<h5><span style="color: #993300;">Process: Working Set</span></h5>
<p>This counter shows the amount of memory a process can use. This counter value shows whether you have set optimum value in <em>min server memory</em> and <em>max server memory</em> configuration or not. If this value shows constantly below <em>min server memory</em> and <em>max server memory</em> then you have configured too much memory for your SQL Server.</p>
<h5><span style="color: #993300;">SQL Server: Buffer Manager: Buffer Cache Hit Ratio</span></h5>
<p>This is very important counter and this counter shows the number of percentage that has been satisfied using data cache. Suppose the value of buffer cache hit ratio for your server is 94 it means 94% of total requests for data have been processed using data cache.</p>
<p>The ideal value for this counter is more than 90. Higher the value better the memory health.</p>
<h5><span style="color: #993300;">SQL Server: Buffer Manager: Page Life Expectancy</span></h5>
<p>Page Life Expectancy is very important counter to measure memory pressure for your system. THis counter indicates the average number of seconds a data page to remain in cache. Ideally, we have read multiple blogs to consider 300 or more as acceptable value but this value varies depending on your system configuration.</p>
<p>The ideal value is more than 300 but always compare this value with your system configuration. Higher the better concept is also applying here.</p>
<h5><span style="color: #993300;">SQL Server: Buffer Manager: Free List Stalls/sec</span></h5>
<p>This counter also shows a sign of memory pressure or insufficient memory on your server. This displays the number of requests per second where data requests stall because there are no buffers available. Any value greater than two indicates that SQL Server needs more memory.</p>
<h5><span style="color: #993300;">SQL Server: Buffer Manager: Lazy Writes/sec</span></h5>
<p>This counter tells about total number of Lazy writer performed in a second.  It means total number of times Lazy Writer process moves dirty pages from the buffer to disk. A lower number is better than a higher number. If value of this counter shows higher value continuously more than 20, then we need to add more memory to the system or we should think about optimizing memory intensive operations.</p>
<h5><span style="color: #993300;">SQL Server: Buffer Manager: Checkpoint Pages/sec</span></h5>
<p>This counter monitors the number of dirty pages per second, which are flushed to disk when SQL Server invokes the checkpoint process. High values for this counter may indicate memory pressure or insufficient memory.</p>
<h5><span style="color: #993300;">SQL Server: Memory Manager: Memory Grants Pending</span></h5>
<p>This counter shows the number of processes waiting for memory grant per second. Any value higher than zero indicates a lack of memory. We can also get this information by using a DMV sys.dm_exec_query_memory_grants. Those processes who are waiting to be granted the required memory will show you waiting with RESOURCE_SEMAPHORE wait type. I have explained about resource semaphore wait type in below attached article.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/resource_semaphore-wait-type/" target="_blank" rel="noopener">Fix RESOURCE_SEMAPHORE Wait Type in SQL Server</a></strong></li>
</ul>
<p>Here, I have described top 10 performance counters to identify SQL Server memory pressure on your database server. I hope you like this article. Please follow our <a href="https://www.facebook.com/Techyaz/">Facebook</a> page and <a href="https://twitter.com/Tech_yaz">Twitter</a> handle to get latest updates.</p>
<p><em><strong><span style="color: #800000;">Read More:</span></strong></em></p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/sql-server-encountered-32-occurrences-requests-taking-longer-15-seconds-complete/" target="_blank" rel="noopener">Fix Error 833: SQL Server has encountered 32 occurrences of I/O requests taking longer than 15 seconds to complete.</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/performing-online-index-rebuild-operation/" target="_blank" rel="noopener">Disk and Performance Impact of running Online Index Rebuild Operation</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/async_io_completion-wait-type/" target="_blank" rel="noopener">Understanding ASYNC_IO_COMPLETION Wait Type</a></strong></li>
</ul>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/top-10-performance-counters-to-identify-sql-server-memory-pressure/">Top 10 Performance Counters to Identify SQL Server Memory Pressure</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/performance-tuning/top-10-performance-counters-to-identify-sql-server-memory-pressure/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Reduce PREEMPTIVE_OS_WRITEFILEGATHER Wait Type in SQL Server?</title>
		<link>https://techyaz.com/sql-server/wait-types/reduce-wait-type-preemptive_os_writefilegather/</link>
					<comments>https://techyaz.com/sql-server/wait-types/reduce-wait-type-preemptive_os_writefilegather/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Tue, 16 Jan 2018 09:04:35 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Wait Types]]></category>
		<category><![CDATA[autogrowth setting]]></category>
		<category><![CDATA[data file autogrow]]></category>
		<category><![CDATA[IFI]]></category>
		<category><![CDATA[Instant File Initialization]]></category>
		<category><![CDATA[Waittypes]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1496</guid>

					<description><![CDATA[<p>I was getting wait type PREEMPTIVE_OS_WRITEFILEGATHER during database size allocation. Yesterday, I was configuring database size to the value that was suggested by the vendor. We need to set database size to 700GB keeping 150 GB to log files. I&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/wait-types/reduce-wait-type-preemptive_os_writefilegather/">How to Reduce PREEMPTIVE_OS_WRITEFILEGATHER Wait Type in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I was getting wait type <em>PREEMPTIVE_OS_WRITEFILEGATHER</em> during database size allocation. Yesterday, I was configuring database size to the value that was suggested by the vendor. We need to set database size to 700GB keeping 150 GB to log files. I have successfully configured data files sizes in less than 2 minutes because we had already enabled <a href="http://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">Instant File Initialization</a>. As we know Instant File Initialization (IFI) speeds up the data file size allocation by skipping the zero-initialize operation. But when i started extending log file sizes, it took lot of time. One reason for taking longer time might be because of wait type <em>PREEMPTIVE_OS_WRITEFILEGATHER</em> that was showing for the session id that was running to allocate log file space.</p>
<h4><span style="color: #333399;">What is PREEMPTIVE_OS_WRITEFILEGATHER?</span></h4>
<p>As per MSDN, <em>PREEMPTIVE_OS_WRITEFILEGATHER</em> is a wait type that occurs while SQL Server is waiting for the Operating System to complete portions of write operations. This wait is commonly seen in databases with <a href="http://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">auto-growth not configured appropriately</a> or during large size allocation to database files. If you are getting this wait type frequently then you should investigate your SQL Server instance. You can also observe this wait type along with <a href="http://techyaz.com/sql-server/backupbuffer-wait-type/" target="_blank" rel="noopener">BACKUPBUFFER</a>  and LOGBUFFER wait types.</p>
<p><img fetchpriority="high" decoding="async" class="size-full wp-image-1498 alignleft" src="http://techyaz.com/wp-content/uploads/2018/01/PREEMPTIVE_OS_WRITEFILEGATHER-min.png" alt="PREEMPTIVE_OS_WRITEFILEGATHER" width="560" height="315" srcset="https://techyaz.com/wp-content/uploads/2018/01/PREEMPTIVE_OS_WRITEFILEGATHER-min.png 560w, https://techyaz.com/wp-content/uploads/2018/01/PREEMPTIVE_OS_WRITEFILEGATHER-min-300x169.png 300w" sizes="(max-width: 560px) 100vw, 560px" /></p>
<p>Sometimes, we get this wait type during database restore operation as well. As we know backup operation captures details like database file sizes irrespective of how much data or logs filled inside the data or log file. When you execute restore operation, it will create that much big file and it will take more time because SQL Server will be busy in zeroing out the file equivalent to source data or log file size. If you have enabled IFI on your database server then you will not be getting this wait type for data files but still you might get it for log file size allocation.</p>
<p>Suppose your database has 100GB of log file and only 12 GB is filled. If you take backup of this database and restore it anywhere then restore operation will create a log file of 100GB that will take lot much time because of zero initialized operation to be performed for all 100GB size.</p>
<h4><span style="color: #333399;">Solutions to Reduce Wait Type PREEMPTIVE_OS_WRITEFILEGATHER</span></h4>
<p>Microsoft has given a feature Instant File Initialization to overcome or reduce this wait type but this feature works for only data files not log files. We hope this feature will work on both data as well as log files in future releases of SQL Servers.</p>
<p>If you are getting this wait type during extending data files or during data file autogrowth then you can simply enable Instant File Initialization on your SQL Server database server and this wait type will disappear from next time. This feature will skip zero-initialization of data files and directly allocate given size to the data files. Read attached article to <a href="http://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">learn Instant File Initialization and how to enable it on your SQL Server Instance</a>?</p>
<p>But we know this feature does not work on log files so we cannot use this feature to reduce this wait type if it occurs during extending log file or during log file autogrowth. We faced same issue because we had already enabled Instant File Initialization for data files but stuck during extending log files. Here I will give you few best practices that you can apply to avoid and reduce this wait type.</p>
<ol>
<li>Increase auto-growth from the default value to some numeric value to reduce the frequent auto-growth occurrence for your database file. Thumb rule is to keep autogrowth size one eight of the corresponding database-file size. Read this article to know the <a href="http://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">Perfect value for database file Autogrowth?</a></li>
<li>If possible avoid auto-growth occurrence by allocating expected size grown in future to the database.</li>
<li>Monitor Storage subsystems and Investigate if any issues identified. Upgrade Storage if required.</li>
<li>Have a look at the Windows Event Viewer for any system related issues.</li>
<li>Enable Instant File Initialization to avoid zero-initialization for data files.</li>
<li>Consolidate transactions from row-by-row statements to batch processing.</li>
<li>If you have bigger log file having small number of logs filled inside. You can <a href="http://techyaz.com/sql-server/sql-server-dmvs/4-different-usages-dbcc-sqlperf-sql-server/" target="_blank" rel="noopener">check log file size using DBCC SQLPERF command</a> given in attached article. You can shrink the log file and take the backup again to perform the restore. This should be a quick process rather than waiting for zeroing to complete for previous size of log file.</li>
<li>Stop any activity to free-up the target disk&#8217;s header so that it can dedicatedly work on zeroing out the LDF file.</li>
</ol>
<p><span style="color: #800000;"><em><strong>Read More:</strong></em></span></p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/improve-sql-server-bulk-data-import-performance/" target="_blank" rel="noopener">How to Speed up Huge Data Load in SQL Server?</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/async_io_completion-wait-type/" target="_blank" rel="noopener">Understanding ASYNC_IO_COMPLETION Wait Type</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/manage-transaction-log-file-during-data-load/" target="_blank" rel="noopener">Manage Transaction Log File during Data Load</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/" target="_blank" rel="noopener">Understanding SQL Server Wait Types</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/resource_semaphore-wait-type/" target="_blank" rel="noopener">How to reduce RESOURCE_SEMAPHORE wait type?</a></strong></li>
</ul>
<p>I hope you like this article. Please follow our <a href="https://www.facebook.com/Techyaz/">Facebook</a> page and <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/wait-types/reduce-wait-type-preemptive_os_writefilegather/">How to Reduce PREEMPTIVE_OS_WRITEFILEGATHER Wait Type in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/wait-types/reduce-wait-type-preemptive_os_writefilegather/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>4 Different Usages of DBCC SQLPERF in SQL Server</title>
		<link>https://techyaz.com/sql-server/sql-server-dmvs/4-different-usages-dbcc-sqlperf-sql-server/</link>
					<comments>https://techyaz.com/sql-server/sql-server-dmvs/4-different-usages-dbcc-sqlperf-sql-server/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Mon, 08 Jan 2018 11:02:31 +0000</pubDate>
				<category><![CDATA[DBCC & DMVs]]></category>
		<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[Wait Types]]></category>
		<category><![CDATA[DBCC]]></category>
		<category><![CDATA[dmv]]></category>
		<category><![CDATA[latches]]></category>
		<category><![CDATA[log space]]></category>
		<category><![CDATA[log_files]]></category>
		<category><![CDATA[transaction log]]></category>
		<category><![CDATA[wait statistics]]></category>
		<category><![CDATA[Waittypes]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1445</guid>

					<description><![CDATA[<p>DBCC SQLPERF is very useful command that we use to get multiple statistics related information in SQL Server. This command provides transaction log space statistics and wait statistics information at instance level and we also use it to reset wait and&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/sql-server-dmvs/4-different-usages-dbcc-sqlperf-sql-server/">4 Different Usages of DBCC SQLPERF in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>DBCC SQLPERF is very useful command that we use to get multiple statistics related information in SQL Server. This command provides <a href="http://techyaz.com/sql-server/understanding-transaction-log-architecture/" target="_blank" rel="noopener">transaction log</a> space statistics and wait statistics information at instance level and we also use it to reset wait and latch statistics data. We can use DBCC SQLPERF command to do below tasks.</p>
<ol>
<li>Get log space size</li>
<li>View wait statistics data</li>
<li>Clear wait statistics data</li>
<li>Clear latch statistics data</li>
</ol>
<p>Let’s discuss each of above tasks as use cases of DBCC SQLPERF command.</p>
<p><em><strong><span style="color: #800000;">Read More</span></strong></em></p>
<ul>
<li><a href="http://techyaz.com/sql-server/get-total-virtual-log-files/" target="_blank" rel="noopener">How to get total no of VLFs (Virtual Log Files) inside Log file?</a></li>
<li><a href="http://techyaz.com/sql-server/understanding-sql-server-data-files-pages-extents/" target="_blank" rel="noopener">Understanding Data Files, Pages &amp; Extents</a></li>
<li><a href="http://techyaz.com/sql-server/how-to-avoid-page-split-in-sql-server/" target="_blank" rel="noopener">How to Avoid Page Split in SQL Server?</a></li>
</ul>
<h4><span style="color: #333399;">Get Transaction Log space using DBCC SQLPERF</span></h4>
<p>We can get transaction log space utilization details like how large your transaction logs are and what percentage of them is in use by executing dbcc sqlperf command. Run below command to get the log space details of all database hosted your SQL Server Instance.</p>
<div class="codediv">
<pre><strong><span style="color: #008000;">--Get Transaction Log Size Details</span>
<span style="color: #0000ff;">DBCC SQLPERF(logspace)
</span></strong></pre>
</div>
<p>You can see the below screenshot; all the columns are self-explanatory. We can see percent of log space used out of total space allocated to the log file.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1447" src="http://techyaz.com/wp-content/uploads/2018/01/1-Check-log-space.jpg" alt="Check Log space utilization using dbcc sqlperf" width="417" height="236" srcset="https://techyaz.com/wp-content/uploads/2018/01/1-Check-log-space.jpg 417w, https://techyaz.com/wp-content/uploads/2018/01/1-Check-log-space-300x170.jpg 300w" sizes="(max-width: 417px) 100vw, 417px" /></p>
<h4><span style="color: #333399;">View and Clear Wait Statistics Data</span></h4>
<p>We can get wait statistics data using dbcc sqlperf command as well. We used to get these details using dbcc sqlperf command in older version of SQL Server instances. Although, you can still get wait statistics data using this command in current versions of SQL Server but now there is a better way to get such details using DMV <strong>sys.dm_os_wait_stats</strong>.  Here, I will show you wait stats data using DMV only. Run below commands to get wait statistics details of your SQL Server instance.</p>
<div class="codediv">
<pre><strong><span style="color: #008000;">--Get wait Statistics using DBCC command.</span>
DBCC SQLPERF(waitstats)

<span style="color: #008000;">--Get Wait Statistics using DMV sys.dm_os_wait_stats</span>
SELECT * FROM sys.dm_os_wait_stats
Order by wait_time_ms desc
</strong></pre>
</div>
<p>You can see the details about all wait types on your SQL Server instance. You can also see the total wait time in milliseconds. These information is very important to deal with performance issues but details like total wait time, total waiting tasks count are not the real-time values. These values are accumulated since last SQL Server service start or last time wait stats was reset using dbcc sqlperf command. It is highly recommended to not clear wait stats data until it is required to do that otherwise you will lose valuable information about wait statistics. Read attached article about <a href="http://techyaz.com/sql-server/sql-server-dmvs/clear-wait-statistics-data-sql-server/" target="_blank" rel="noopener">why should you not clear wait statistics data stored in DMV sys.dm_os_wait_stats</a>.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1448" src="http://techyaz.com/wp-content/uploads/2018/01/2-sys.dm_os_wait_stats.jpg" alt="View Wait stats data using DMV" width="643" height="300" srcset="https://techyaz.com/wp-content/uploads/2018/01/2-sys.dm_os_wait_stats.jpg 643w, https://techyaz.com/wp-content/uploads/2018/01/2-sys.dm_os_wait_stats-300x140.jpg 300w" sizes="(max-width: 643px) 100vw, 643px" /></p>
<p>If you want to get the correct waiting task counts or waiting time then you need to clear the wait statistics data using dbcc sqlperf command. Here, I will show you the difference after clearing the wait stats. Run below command to clear all wait stats data on your SQL Server Instance.</p>
<div class="codediv">
<pre><strong>DBCC SQLPERF(“sys.dm_os_wait_stats”, CLEAR)
</strong></pre>
</div>
<p>You can see I have successfully ran this command in below screenshot.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1449" src="http://techyaz.com/wp-content/uploads/2018/01/3-Clear-buffer-for-wait-stats.jpg" alt="clear wait stats" width="689" height="121" srcset="https://techyaz.com/wp-content/uploads/2018/01/3-Clear-buffer-for-wait-stats.jpg 689w, https://techyaz.com/wp-content/uploads/2018/01/3-Clear-buffer-for-wait-stats-300x53.jpg 300w" sizes="auto, (max-width: 689px) 100vw, 689px" /></p>
<p>Now we will again run same command to get the wait statistics data. I ran it and I get below data that is showing different than the one showing before clearing wait stats. This way you can better analyze your database performance and waiting tasks and time to reach on any conclusion.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1450" src="http://techyaz.com/wp-content/uploads/2018/01/4-Check-wait-stats-after-clearning-buffer.jpg" alt="Check wait stats after clearing its buffer" width="804" height="283" srcset="https://techyaz.com/wp-content/uploads/2018/01/4-Check-wait-stats-after-clearning-buffer.jpg 804w, https://techyaz.com/wp-content/uploads/2018/01/4-Check-wait-stats-after-clearning-buffer-300x106.jpg 300w, https://techyaz.com/wp-content/uploads/2018/01/4-Check-wait-stats-after-clearning-buffer-768x270.jpg 768w" sizes="auto, (max-width: 804px) 100vw, 804px" /></p>
<p>&nbsp;</p>
<h4><span style="color: #333399;">Clear Latch Statistics Data</span></h4>
<p>I described about clearing wait stats data in above section. Here, I will show you how to clear latch statistics data. <b>Latches</b> are locks for RAM memory structures to prevent concurrent access and ensure serial execution of kernel code. You can run SQL command to check current latch statistics data.</p>
<div class="codediv">
<pre><span style="color: #008000;"><span style="color: #008000;"><b>--Get latch statistics data</b></span></span><b>
SELECT * FROM sys.dm_os_latch_stats
ORDER BY wait_time_ms desc
</b></pre>
</div>
<p>You can see current latch statistics details that is also not showing only real time value but it is accumulated data since last SQL Server service restarted or last time latch wait statistics was reset/cleared.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1451" src="http://techyaz.com/wp-content/uploads/2018/01/5-Check-Latch.jpg" alt="Get Latch Statistics Data" width="678" height="217" srcset="https://techyaz.com/wp-content/uploads/2018/01/5-Check-Latch.jpg 678w, https://techyaz.com/wp-content/uploads/2018/01/5-Check-Latch-300x96.jpg 300w" sizes="auto, (max-width: 678px) 100vw, 678px" /></p>
<p>&nbsp;</p>
<p>Now we will clear these latch statistics data to get real time value of latch details. Run below dbcc sqlperf command to clear the latch statistics.</p>
<div class="codediv">
<pre><strong>DBCC SQLPERF(“sys.dm_os_latch_stats”, CLEAR)
</strong></pre>
</div>
<p>You can see we have successfully executed above command on our SQL Server Instance.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1452" src="http://techyaz.com/wp-content/uploads/2018/01/6-Clear-stored-latch-details.jpg" alt="Clear Latch Statistics Data" width="722" height="121" srcset="https://techyaz.com/wp-content/uploads/2018/01/6-Clear-stored-latch-details.jpg 722w, https://techyaz.com/wp-content/uploads/2018/01/6-Clear-stored-latch-details-300x50.jpg 300w" sizes="auto, (max-width: 722px) 100vw, 722px" /></p>
<p>Now go ahead and run same SQL command to get the latch statistics again. You can see now there is no waiting requests on our SQL Server Instance and you are getting real time value about latches.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1453" src="http://techyaz.com/wp-content/uploads/2018/01/7-check-latch-details-after-clearning-buffer.jpg" alt="latch details after cleaning its buffer data " width="677" height="197" srcset="https://techyaz.com/wp-content/uploads/2018/01/7-check-latch-details-after-clearning-buffer.jpg 677w, https://techyaz.com/wp-content/uploads/2018/01/7-check-latch-details-after-clearning-buffer-300x87.jpg 300w" sizes="auto, (max-width: 677px) 100vw, 677px" /></p>
<p><em><strong><span style="color: #800000;">Related Articles</span></strong></em></p>
<ul>
<li><a href="http://techyaz.com/sql-server/sql-server-dmvs/clear-wait-statistics-data-sql-server/" target="_blank" rel="noopener">Should We Clear Wait Stats Data from DMV sys.dm_os_wait_stats?</a></li>
<li><a href="http://techyaz.com/sql-server/backupbuffer-wait-type/" target="_blank" rel="noopener">How to Fix BACKUPBUFFER Wait Type?</a></li>
<li><a href="http://techyaz.com/sql-server/improve-sql-server-bulk-data-import-performance/" target="_blank" rel="noopener">How to Improve Bulk Data Load Performance?</a></li>
</ul>
<p>These are the 4 use cases of DBCC SQLPERF command that we use during different database activities. I hope you like this article. Please follow our <a href="https://www.facebook.com/Techyaz/">Facebook</a> page and <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/sql-server-dmvs/4-different-usages-dbcc-sqlperf-sql-server/">4 Different Usages of DBCC SQLPERF in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/sql-server-dmvs/4-different-usages-dbcc-sqlperf-sql-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Fix Event ID 833: SQL Server has encountered 32 occurrence(s) of I/O requests taking longer than 15 seconds to complete.</title>
		<link>https://techyaz.com/sql-server/performance-tuning/sql-server-encountered-32-occurrences-requests-taking-longer-15-seconds-complete/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/sql-server-encountered-32-occurrences-requests-taking-longer-15-seconds-complete/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Wed, 22 Nov 2017 13:44:54 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Wait Types]]></category>
		<category><![CDATA[Disk IO]]></category>
		<category><![CDATA[IO]]></category>
		<category><![CDATA[performance tuning]]></category>
		<category><![CDATA[Poor Disk IO]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1183</guid>

					<description><![CDATA[<p>Last week, we found some slowness in one of our database server. When we analyzed the database server, we found poor disk performance where I/O requests taking longer than 15 seconds to complete. Below messages were logged multiple times in error&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/sql-server-encountered-32-occurrences-requests-taking-longer-15-seconds-complete/">Fix Event ID 833: SQL Server has encountered 32 occurrence(s) of I/O requests taking longer than 15 seconds to complete.</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Last week, we found some slowness in one of our database server. When we analyzed the database server, we found <a href="https://techyaz.com/sql-server/identify-disk-bottleneck-using-perfmon-counters/" target="_blank" rel="noopener">poor disk performance</a> where I/O requests taking longer than 15 seconds to complete. Below messages were logged multiple times in error log file under event id 833. Here i will describe about fixing Microsoft SQL Server Error 833.</p>
<p><span style="color: #ff0000;">SQL Server has encountered 32 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [E:\MSSQL\Data\database_file.mdf] in database [Database_Name] (%d). The OS file handle is 0x000000F543. The offset of the latest long I/O is: 0x000000004h583. </span></p>
<p>This message indicates that SQL Server has issued a read or write request from disk, and the I/O requests taking longer than 15 seconds to return. Microsoft SQL Server reports Event Id 833 to the event log, and above text in the ERRORLOG file along with other symptoms like high wait times for PAGEIOLATCH waits or other disk IO related wait types in SQL Server.</p>
<p><img loading="lazy" decoding="async" class="wp-image-1187 aligncenter" src="https://techyaz.com/wp-content/uploads/2017/11/event-id-833-e1527855680849-1024x420.jpg" alt="event id 833" width="664" height="272" srcset="https://techyaz.com/wp-content/uploads/2017/11/event-id-833-e1527855680849-1024x420.jpg 1024w, https://techyaz.com/wp-content/uploads/2017/11/event-id-833-e1527855680849-300x123.jpg 300w, https://techyaz.com/wp-content/uploads/2017/11/event-id-833-e1527855680849-768x315.jpg 768w, https://techyaz.com/wp-content/uploads/2017/11/event-id-833-e1527855680849.jpg 1147w" sizes="auto, (max-width: 664px) 100vw, 664px" /></p>
<h5><span style="color: #333399;">Why we get this issue/warning?</span></h5>
<p>SQL Server database is designed to perform intensive disk I/O operations. An I/O operation may be either a read or a write operation and the standard disk speed to perform these operations is around 10 milliseconds or less. If any of the read or write operation takes more time to perform their activity and generally disk speed reaches or exceeds 15 seconds of time, then database engine reports event id 833 along with above log information in error log file.</p>
<p>If you receive such messages, it does not mean problems with SQL Server. They are reported to let DBAs and system administrator know about poor storage performance and help them to investigate why the I/O request took so long. Long I/Os often indicate a SQL Server workload that is too intense for the disk subsystem. Disk Subsystems perform poorly/slowly because of either stuck or stalled IO operations. Before going ahead let’s first understand about stuck and stalled IO operation.</p>
<h6><span style="color: #333399;"><strong>Stuck I/O</strong></span></h6>
<p>Stuck I/O is defined as an I/O request that does not finish.  To resolve a stuck I/O condition, you must usually restart the computer or perform a similar action. A stuck I/O condition typically indicates one of the following:</p>
<ul>
<li>Faulty hardware</li>
<li>A bug in an I/O path component</li>
</ul>
<h6><span style="color: #333399;"><strong>Stalled I/O</strong></span></h6>
<p>Stalled I/O is defined as an I/O request that does finish or that takes excessive time to finish. Stalled I/O behavior typically occurs because of one of the following reasons:</p>
<ul>
<li>The hardware configuration</li>
<li>The firmware settings</li>
</ul>
<p>Below is the list of items that can cause stuck or stalled I/O operations on disk subsystem that can adversely affect SQL Server performance.</p>
<ul>
<li>Faulty hardware</li>
<li>Incorrectly configured hardware</li>
<li>Firmware settings</li>
<li>Filter drivers</li>
<li>Compression</li>
<li>Bugs</li>
<li>All transactions are in one drive like (backup, live database updates)</li>
<li>Blocking</li>
<li>Latch contentions</li>
<li>Missing Indexes in databases</li>
</ul>
<h5><span style="color: #333399;">Resolution</span></h5>
<p>Disk I/O problems are one of the most difficult problems to diagnose and to find the root cause. There might be multiple reasons due to which your disk subsystems perform slow. First step towards fixing such issue is to examining the event logs for any hardware related error messages and then proceed towards fix accordingly. Follow below steps to reduce the IO overheads on your database server if I/O requests taking longer than 15 seconds or perfoming slow.</p>
<ol start="1">
<li>Check &amp; update all missing device drivers and firmware with the latest updates.</li>
</ol>
<ol start="2">
<li>Analyze memory pressure and CPU usages trends as well because if you will run with CPU or memory pressure, there might be possibility slow disk performance.</li>
</ol>
<ol start="3">
<li>Monitor <a href="https://techyaz.com/sql-server/identify-disk-bottleneck-using-perfmon-counters/" target="_blank" rel="noopener">disk I/O performance counters either using Performance Monitor</a> or using DMVs to examine your disk subsystem workload. Read attached article to get the optimum values for all given counters. It’s highly recommended to monitor these counters for a while, and then compare it to your disk baselines value that you had captured during stress testing or load testing exercise.</li>
</ol>
<ul>
<li><em>Average Disk Sec/Transfer</em></li>
<li><em>Average Disk Sec/Read</em></li>
<li><em>Average Disk Sec/Write</em></li>
<li><em>Average Disk Queue Length</em></li>
<li><em>Current Disk Queue Length</em></li>
<li><em>Disk Read/Sec</em></li>
<li><em>Disk Write/Sec</em></li>
<li><em>%Disk Time</em></li>
</ul>
<ol start="4">
<li>Microsoft suggests being careful when you use the performance counters because SQL Server takes full advantage of asynchronous I/O capabilities that push the disk queue lengths heavily. Therefore, longer disk queue lengths alone do not indicate a problem. So, compare every counter with their baseline and then analyze the trend.</li>
</ol>
<ol start="5">
<li>Monitor <a href="https://techyaz.com/sql-server/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/" target="_blank" rel="noopener">SQL Server Wait Types</a>, If the disk is slowing all the times then you will get wait types PAGEIOLATCH, WRITELOG or LOGBUFFER with high wait time.</li>
</ol>
<ol start="6">
<li>Exclude SQL Server Data and Log files from antivirus software scans. If your <a href="https://techyaz.com/sql-server/understanding-sql-server-data-files-pages-extents/" target="_blank" rel="noopener">database files</a> are configured to be scanned by antivirus software then this will have slowed your disk performance.</li>
</ol>
<ol start="7">
<li>If you are getting this issue on a specific time then I would suggest checking the conflict between your SQL Server Agent Jobs? There might be some data load/Disk IO intensive query or database maintenance activities will be running parallelly at the same time. Change the Agent jobs schedule time carefully so that they should not conflict to each other.</li>
</ol>
<ol start="8">
<li>Don’t place database files and backups on single drive. Always place data file, <a href="https://techyaz.com/sql-server/understanding-transaction-log-architecture/" target="_blank" rel="noopener">log files</a> and tempdb files on separate drives to reduce disk IO overhead. Also, it is highly recommended to run backups on separate drive because if you run backups on data drives then this can reduce disk performance.</li>
</ol>
<ol start="9">
<li>Check your database files property for which you are getting this error. The size of database files should not be limited to fixed size with auto growth disabled. Enabling the auto growth of all the data files with appropriate value can fix this issue if you have put limits of database files growth. Read the attached article to <a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">understand the best value for database file autogrowth</a>.</li>
</ol>
<ol start="10">
<li>Disk I/O can perform poorly if there is no proper indexing on your tables. You can use Index Turning Wizard to resolve I/O pressure on the system. You can find missing indexes from most used or accessed tables and create appropriate indexes to reduce query time and resources overhead.</li>
</ol>
<h5><span style="color: #333399;">Disable this Error to Log using Trace flag 830</span></h5>
<p>Microsoft has given us an option to disable stalled or stuck I/O detection by using trace flag 830, although we do not recommend that you do this.</p>
<p>To disable detection when SQL Server starts, use the <strong>-T830</strong> startup parameter to disable detection every time that SQL Server is started. To disable detection for an instance of SQL Server that is currently running, use the following statement:</p>
<pre><strong><span style="color: #0000ff;">dbcc traceoff(830, -1)
</span></strong></pre>
<p>This setting is effective only for the life of the SQL Server process.</p>
<p><em><span style="color: #800000;"><strong>Related Articles:</strong></span></em></p>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/identify-disk-bottleneck-using-perfmon-counters/" target="_blank" rel="noopener">Identify Disk Bottleneck in SQL Server using Perfmon Disk Counters</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/improve-sql-server-bulk-data-import-performance/" target="_blank" rel="noopener">How to Improve Bulk Data Load Performance?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/async_io_completion-wait-type/" target="_blank" rel="noopener">What is ASYNC_IO_COMPLETION wait type?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/backupbuffer-wait-type/" target="_blank" rel="noopener">Understanding BACKUPBUFFER wait type</a></strong></li>
</ul>
<p>I hope you like this article. Please follow our <a href="https://www.facebook.com/Techyaz/">Facebook</a> and <a href="https://twitter.com/Tech_yaz">Twitter</a> handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/sql-server-encountered-32-occurrences-requests-taking-longer-15-seconds-complete/">Fix Event ID 833: SQL Server has encountered 32 occurrence(s) of I/O requests taking longer than 15 seconds to complete.</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/performance-tuning/sql-server-encountered-32-occurrences-requests-taking-longer-15-seconds-complete/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Understanding ASYNC_IO_COMPLETION Wait type in SQL Server</title>
		<link>https://techyaz.com/sql-server/async_io_completion-wait-type/</link>
					<comments>https://techyaz.com/sql-server/async_io_completion-wait-type/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Tue, 24 May 2011 09:54:00 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Wait Types]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[performance tuning]]></category>
		<category><![CDATA[Waittypes]]></category>
		<guid isPermaLink="false"></guid>

					<description><![CDATA[<p>Normally, ASYNC_IO_COMPLETION Wait type can be seen during backup and restore activities. Whenever you will see this wait type your backup/restore process will be in suspended state most of the time because the process is waiting to get IO resource&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/async_io_completion-wait-type/">Understanding ASYNC_IO_COMPLETION Wait type in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Normally, ASYNC_IO_COMPLETION <strong><a href="https://techyaz.com/sql-server/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/" target="_blank" rel="noopener">Wait type</a> </strong>can be seen during backup and restore activities. Whenever you will see this wait type your backup/restore process will be in suspended state most of the time because the process is waiting to get IO resource to proceed their operation and it will wait till certain time period then moved in suspended state. In that case your process will take more than its usual time to complete or most of the time it will hung or will showing in executing state for unknown time duration.</p>
<p><em><strong><span style="color: #800000;">Related Articles:</span></strong></em></p>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/" target="_blank" rel="noopener">Understanding SQL Server Wait Types</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/resource_semaphore-wait-type/" target="_blank" rel="noopener">How to deal with Resource Semaphore Wait type?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/backupbuffer-wait-type/" target="_blank" rel="noopener">What is BACKUPBUFFER Wait type?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/reduce-wait-type-preemptive_os_writefilegather/" target="_blank" rel="noopener">How to Reduce SQL Server Wait type PREEMPTIVE_OS_WRITEFILEGATHER?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/improve-sql-server-bulk-data-import-performance/" target="_blank" rel="noopener">How to Improve SQL Server Bulk Data Load Performance?</a></strong></li>
</ul>
<p>ASYNC_IO_COMPLETION wait type occurs when a task is waiting for asynchronous I/Os to finish.  This wait type is normally seen with few other wait types like <a href="https://techyaz.com/sql-server/backupbuffer-wait-type/" target="_blank" rel="noopener">BACKUPBUFFER</a>, BACKUPIO etc. This is clear indication of DISK IO issue. You can also get the Average disk queue length or current disk queue length value at the same time when you are getting this wait type. Compare both counters and if these counters have high value then you should look into your storage subsystem. Identify disk bottlenecks, by using Perfmon Counters, Profiler, sys.dm_io_virtual_file_stats and SHOWPLAN.</p>
<p>Any of the following will reduce this wait type occurrence:</p>
<ol>
<li>Add additional IO bandwidth.</li>
<li>Balancing IO across other drives. If you are running your backups on same drive in which you have placed your database files. Make sure to keep separate drive for data, log and backups.</li>
<li>Reducing IO with appropriate indexing. This can cause major performance issue if you don&#8217;t have proper indexes.</li>
<li>Check for bad query plans that are consuming most of resources.</li>
<li>Check memory pressure if your server has enough memory to run resource extensive operations.</li>
</ol>
<p>We can also correlate this wait type between Memory pressure and Disk IO subsystem issues.</p>
<p>If you like this tip, you can follow us on our <strong><a href="https://www.facebook.com/Techyaz/">facebook page</a></strong> and on <strong><a href="https://twitter.com/Tech_yaz">Twitter</a></strong> handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/async_io_completion-wait-type/">Understanding ASYNC_IO_COMPLETION Wait type in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/async_io_completion-wait-type/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to fix BACKUPBUFFER Wait Types?</title>
		<link>https://techyaz.com/sql-server/wait-types/backupbuffer-wait-type/</link>
					<comments>https://techyaz.com/sql-server/wait-types/backupbuffer-wait-type/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Fri, 06 May 2011 20:01:00 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Wait Types]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Waittypes]]></category>
		<guid isPermaLink="false">http://techyaz.com/sql-server/wait-types/backupbuffer-wait-type/</guid>

					<description><![CDATA[<p>Today I was working on an issue in which backup job was showing in executing state since last 2 days.Initially my observation was either it was hung in middle of its process or it was processing very slow. Later, i&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/wait-types/backupbuffer-wait-type/">How to fix BACKUPBUFFER Wait Types?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div dir="ltr" style="text-align: left;"></div>
<div>
<div dir="ltr">
<div>Today I was working on an issue in which backup job was showing in executing state since last 2 days.Initially my observation was either it was hung in middle of its process or it was processing very slow. Later, i decided to see the <strong><a href="https://techyaz.com/sql-server/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/" target="_blank" rel="noopener">wait types</a></strong> for this process. When i was gathering this info, i saw the wait type backupbuffer for this transaction.</div>
<h3><span style="color: #333399;">What is BACKUPBUFFER Wait Type</span></h3>
<div>This wait type Occurs when a backup task is waiting for data, or is waiting for a buffer in which to store data. This type is not typical, except when a task is waiting for a tape mount. This wait stats will occur when you are taking the backup on the tape or any other extremely slow backup system.This wait type can be seen with one more wait type i.e. <a href="https://techyaz.com/sql-server/async_io_completion-wait-type/" target="_blank" rel="noopener"><strong>ASYNC_IO_COMPLETION</strong></a>.</div>
<div><img loading="lazy" decoding="async" src="http://www.assoc-amazon.com/e/ir?t=sql031-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=B001UHWHO4" alt="" width="1" height="1" border="0" /></div>
<div>These both wait types indicate that the issue is with storage/disk subsystem. Solution is to either ask your storage team to look in this or change your disk/storage subsystem and run your backup on a healthy and fast storage subsystem. There are other options as well where you should focus if your storage subsystem is ok. Below is the list of options you should look into to overcome from this wait type.</div>
<div>
<ul>
<li>Add additional IO bandwidth to accommodate the load.</li>
<li>Balancing IO across other drives. If you are running your backups on same drive in which you have placed your database files. Make sure to keep separate drive for data, log and backups.</li>
<li>Reducing Disk IO pressure with appropriate <strong><a href="https://techyaz.com/sql-server/understanding-sql-server-indexes/" target="_blank" rel="noopener">indexing</a></strong>. This can cause major performance issue if you don&#8217;t have proper indexes.</li>
<li>Check for bad query plans that are consuming most of resources.</li>
<li>Check memory pressure if your server has enough memory to run resource extensive operations.</li>
</ul>
</div>
</div>
<h5><em><span style="color: #800000;"><strong>Related Articles:</strong></span></em></h5>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/" target="_blank" rel="noopener">Understanding SQL Server Wait Types</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/resource_semaphore-wait-type/" target="_blank" rel="noopener">What is Resource Semaphore Wait type?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/improve-sql-server-bulk-data-import-performance/" target="_blank" rel="noopener">How to Improve Bulk Data Load Performance?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/sql-server-dmvs/clear-wait-statistics-data-sql-server/" target="_blank" rel="noopener">Should We Clear Wait Stats Data from DMV sys.dm_os_wait_stats?</a></strong></li>
</ul>
<div>If you like this tip, you can follow us on our <strong><a href="https://www.facebook.com/Techyaz/">facebook page</a></strong> and on <strong><a href="https://twitter.com/Tech_yaz">Twitter</a></strong> handle to get latest updates.</div>
</div>
<p>The post <a href="https://techyaz.com/sql-server/wait-types/backupbuffer-wait-type/">How to fix BACKUPBUFFER Wait Types?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/wait-types/backupbuffer-wait-type/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How to Fix RESOURCE_SEMAPHORE Wait Type in SQL Server?</title>
		<link>https://techyaz.com/sql-server/wait-types/resource_semaphore-wait-type/</link>
					<comments>https://techyaz.com/sql-server/wait-types/resource_semaphore-wait-type/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Thu, 14 Apr 2011 07:52:00 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Wait Types]]></category>
		<category><![CDATA[Memory Issues]]></category>
		<category><![CDATA[performance tuning]]></category>
		<category><![CDATA[Waittypes]]></category>
		<guid isPermaLink="false"></guid>

					<description><![CDATA[<p>RESOURCE_SEMAPHORE waits occurs when a query memory request cannot be granted immediately due to other concurrent queries. High waits and wait times may indicate excessive number of concurrent queries, or excessive memory request amounts. High waits on RESOURCE_SEMAPHORE usually result&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/wait-types/resource_semaphore-wait-type/">How to Fix RESOURCE_SEMAPHORE Wait Type in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div dir="ltr" style="text-align: left;">
<p>RESOURCE_SEMAPHORE waits occurs when a query memory request cannot be granted immediately due to other concurrent queries. High waits and wait times may indicate excessive number of concurrent queries, or excessive memory request amounts.</p>
<p>High waits on RESOURCE_SEMAPHORE usually result in poor response times for all database users, and need to be addressed.</p>
<p>It is also useful to correlate high waits on RESOURCE_SEMAPHORE with the Memory Grants Pending and Memory Grants Outstanding SQL Memory Manager performance counters. Higher values for these counters indicate a definite memory problem especially a non-zero value for Memory Grants Pending.</p>
<p>Resource Semaphore is a SQL Server internal mechanism that allows a query to reserve memory only if there is enough free memory available otherwise, a requesting query is forced to wait in queue. When resource semaphore receives new request, it first checks if any query is waiting or not. If any query is waiting in queue then the new request will also be added to the queue based on first come first serve allocation. All these requests in queue will show you waiting with RESOURCE_SEMAPHORE wait type. Once enough memory will be available then memory will be granted to the requests in an order they have been queued.</p>
<p>The root cause of this type of memory problem is when memory-intensive queries, such as those involving sorting and hashing, are queued and are unable to obtain the requested memory. The solution would be to tune the offending queries, or manage their workload so that they are executed at less busy times.</p>
<p>SQL Server has provided few DMVs to identify and fix such memory issues. You can have a look at DMV <em>sys.dm_exec_query_resource_semaphore</em> that will show the current status of resource semaphore . You can also see the output of DMV <em>sys.dm_exec_query_memory_grants</em> to display all queries that have memory granted and those who are waiting to be granted the required memory. All waiting queries would have <em>null</em> value in grant_time column in the output of DMV <em>sys.dm_exec_query_memory_grants.</em></p>
<p>You can get the queries that are causing or eating most of the memory using above DMVs and from here you can look at the options of optimizing the memory intensive statements. You can also have a look at below article if your system is facing insufficient memory issue.</p>
<ul>
<li><a href="https://techyaz.com/sql-server/troubleshooting/sql-server-error-701-there-is-insufficient-system-memory-to-run-this-query/" target="_blank" rel="noopener"><strong>SQL Server Error 701 and Error 802: There is Insufficient System Memory to Run this Query</strong></a></li>
<li><a href="https://techyaz.com/sql-server/sql-server-memory-allocation-min-max-server-memory-configuration/" target="_blank" rel="noopener"><strong>Understanding SQL Server Memory Allocation and Role of MIN/MAX Server Memory Configuration</strong></a></li>
</ul>
<p>I hope you like this article. Please drop your questions and feedbacks in below comment section. You can also follow our <a href="https://www.facebook.com/Techyaz/">facebook page</a> and <a href="https://twitter.com/Tech_yaz">Twitter</a> handle to get latest updates.</p>
<p><span style="color: #800000;"><em><strong>Related Articles:</strong></em></span></p>
<ul>
<li><a href="https://techyaz.com/sql-server/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/" target="_blank" rel="noopener"><strong>Understanding SQL Server Wait Types</strong></a></li>
<li><a href="https://techyaz.com/sql-server/async_io_completion-wait-type/" target="_blank" rel="noopener"><strong>How to Deal with ASYNC_IO_COMPLETION wait type?</strong></a></li>
<li><a href="https://techyaz.com/sql-server/backupbuffer-wait-type/" target="_blank" rel="noopener"><strong>Understanding BACKUPBUFFER Wait type</strong></a></li>
</ul>
</div>
<p>The post <a href="https://techyaz.com/sql-server/wait-types/resource_semaphore-wait-type/">How to Fix RESOURCE_SEMAPHORE Wait Type in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/wait-types/resource_semaphore-wait-type/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is SQL Server Wait Type? or How to get wait type info in sql server?</title>
		<link>https://techyaz.com/sql-server/wait-types/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/</link>
					<comments>https://techyaz.com/sql-server/wait-types/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Thu, 14 Apr 2011 07:50:00 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Wait Types]]></category>
		<category><![CDATA[Waittypes]]></category>
		<guid isPermaLink="false"></guid>

					<description><![CDATA[<p> Wait Types are awesome way to troubleshoot performance related issues. In SQL Server 2005 and later version we can get wait type info from various DMVs. One of the most useful DMV is sys.dm_qs_wait_stats.This DMV gives you the detail report&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/wait-types/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/">What is SQL Server Wait Type? or How to get wait type info in sql server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div dir="ltr" style="text-align: left;"> Wait Types are awesome way to troubleshoot performance related issues. In SQL Server 2005 and later version we can get wait type info from various DMVs. One of the most useful DMV is sys.dm_qs_wait_stats.This DMV gives you the detail report of all wait types and you can look into those wait types which are causing issue or waiting from lot much time. You can use this aggregated view to diagnose performance issues with SQL Server and also with specific queries and batches. Following columns will come in output when you run this DMV:</div>
<div dir="ltr">
<ul>
<li><strong>wait_type :-</strong> Name of the wait type.<u><br />
</u><strong>waiting_tasks_count:-</strong>Number of waits on this wait type. This counter is incremented at the start of each wait.</li>
<li><strong>wait_time_ms:-</strong>Total wait time for this wait type in milliseconds. This time is inclusive of signal_wait_time_ms.</li>
<li><strong>max_wait_time_ms:-</strong> Maximum wait time on this wait type.</li>
<li><strong>signal_wait_time_ms:-</strong>Difference between the times that the waiting thread was signaled and when it started running.</li>
</ul>
<p>In general there are three categories of waits that could affect any given request:</p>
<ul>
<li><strong>Resource waits</strong> are caused by a particular resource, perhaps a specific lock that is unavailable when the requested is submitted. Resource waits are the ones you should focus on for troubleshooting the large majority of performance issues.</li>
<li><strong>External waits</strong> occur when SQL Server worker thread is waiting on an external process, such as extended stored procedure to be completed. External wait does not necessarily mean that the connection is idle; rather it might mean that SQL Server is executing an external code which it cannot control. Finally the queue waits occur if a worker thread is idle and is waiting for work to be assigned to it.</li>
<li><strong>Queue waits</strong> normally apply to internal background tasks, such as ghost cleanup, which physically removes records that have been previously deleted. Normally you don&#8217;t have to worry about any performance degradation due to queue waits.</li>
</ul>
<p>DMV sys.dm_os_wait_stats shows the time for waits that have completed. This DMV does not show current waits. If you want to see current wait type then you should use another system table sys.sysprocesses. Run below command:</p>
<pre><span style="color: #0000ff;"><strong>Select * from sys.sysprocesses</strong></span></pre>
<p>The output describes you the wait time and wait type for each process id. So here you can get which process is pending since how much time and which type of wait is that. Once you have the sp id then you can run below command to get the exact code running behind that SP id:</p>
<pre><strong><span style="color: #0000ff;">DBCC Inputbuffer(SP ID)</span></strong></pre>
<p>You can also compare DMV (sys.dm_os_wait_stats) output to this sysprocesses table output and you can better analyze the exact issue.</p>
<p><span style="color: #800000;"><em><strong>Related Article:</strong></em></span></p>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/resource_semaphore-wait-type/" target="_blank" rel="noopener">Understanding Resource Semaphore Wait Type</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/async_io_completion-wait-type/" target="_blank" rel="noopener">What is ASYNC_IO_COMPLETION Wait Type?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/backupbuffer-wait-type/" target="_blank" rel="noopener">How to deal with BACKUPBUFFER wait type?</a></strong></li>
</ul>
<p>A SQL Server worker thread is not considered to be waiting if any of the following is true:</p>
<p>*      A resource becomes available.<br />
*      A queue is nonempty.<br />
*      An external process finishes.</p>
<p>Although the thread is no longer waiting, the thread does not have to start running immediately. This is because such a thread is first put on the queue of runnable workers and must wait for a quantum to run on the scheduler.</p>
<p>Specific types of wait times during query execution can indicate bottlenecks or stall points within the query. Similarly, high wait times, or wait counts server wide can indicate bottlenecks or hot spots in interaction query interactions within the server instance. For example, lock waits indicate data contention by queries; page IO latch waits indicate slow IO response times; page latch update waits indicate incorrect file layout.</p>
<p>The contents of this dynamic management view can be reset by running the following command:</p>
<pre><strong><span style="color: #0000ff;">DBCC SQLPERF ('sys.dm_os_wait_stats', CLEAR);
GO</span></strong></pre>
<p>This command resets all counters to 0.</p>
<p>I hope you like this article. You can follow our <strong><a href="https://www.facebook.com/Techyaz/">Facebook</a></strong> page and <strong><a href="https://twitter.com/Tech_yaz">Twitter</a></strong> handle to get latest updates.</p>
</div>
<p>The post <a href="https://techyaz.com/sql-server/wait-types/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/">What is SQL Server Wait Type? or How to get wait type info in sql server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/wait-types/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
