<?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>performance tuning - Techyaz.com</title>
	<atom:link href="https://techyaz.com/tag/performance-tuning/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Tips, Tutorials and How-to Topics</description>
	<lastBuildDate>Fri, 23 Jul 2021 12:59:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://techyaz.com/wp-content/uploads/2017/11/cropped-Site-icon-150x150.png</url>
	<title>performance tuning - Techyaz.com</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Fix SQL Server Error 802: There is insufficient memory available in the buffer pool.</title>
		<link>https://techyaz.com/sql-server/fix-sql-server-error-802-insufficient-memory-in-buffer-pool/</link>
					<comments>https://techyaz.com/sql-server/fix-sql-server-error-802-insufficient-memory-in-buffer-pool/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Sat, 12 Jun 2021 09:37:54 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Memory Issues]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">https://techyaz.com/?p=2533</guid>

					<description><![CDATA[<p>We receive SQL Server error 802 when buffer pool of SQL Server instance is full and cannot grow further. Here, i will discuss about this error 802 insufficient memory available in the buffer pool in this article along with its&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/fix-sql-server-error-802-insufficient-memory-in-buffer-pool/">Fix SQL Server Error 802: There is insufficient memory available in the buffer pool.</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>We receive SQL Server error 802 when buffer pool of SQL Server instance is full and cannot grow further. Here, i will discuss about this <em>error 802 insufficient memory available in the buffer pool</em> in this article along with its possible solution to fix it. Below is the error text you might get on your SQL Server system. </p>



<p><span class="has-inline-color has-luminous-vivid-orange-color">SQLServer Error: 802, There is insufficient memory available in the buffer pool. [SQLSTATE 42000]</span></p>



<h2 class="wp-block-heading"><span style="color:#170ce9" class="has-inline-color">SQL Server Error 802 &#8211; Insufficient Memory Available in the Buffer Pool</span></h2>



<p>The main reason behind getting SQL Server error 802 is your SQL Server instance is under memory pressure and there is not enough memory available to allocate further to buffer pool or buffer pool is restricted to not use memory beyond a certain limit. This might be because of various reasons as i have stated in below section. One of the very easy and straight forward approach to fix this error is to increase more memory to SQL Server system and modify max server memory in SQL Server accordingly.</p>



<h2 class="wp-block-heading"><span style="color:#170ce9" class="has-inline-color">Analysis &amp; Solution</span></h2>



<p>I would suggest to go deeper in this issue before taking any decision to allocate more memory to the system where SQL Server is running. There could be multiple temporary reasons as well which can cause SQL Server to generate below error log:</p>



<p><em><strong>SQL Server Error: 802, There is insufficient memory available in the buffer pool. [SQLSTATE 42000]</strong></em></p>



<p>Let&#8217;s discuss this issue further and ensure to not forget below points before taking any decisions.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<ol class="wp-block-list"><li>Check system memory utilization and see if other application (not SQL Server) is not taking enough memory. Try to fix it why a particular application is taking more memory.</li><li>Make sure you have allocated enough memory in min server memory &amp; max server memory setting. You can get these setting by executing <em><strong>sp_configure</strong></em> stored procedure. Sometimes, our server has enough memory but we missed to allocate appropriate memory to SQL Server. Rule is to allocate 80% of server memory to SQL Server under max server memory setting.</li><li>Ensure to <a href="https://techyaz.com/sql-server/enable-lock-pages-in-memory-sql-server/" target="_blank" rel="noreferrer noopener"><strong>enabled Lock Pages in memory</strong></a> on your SQL Server Instance.</li><li>Validate SQL Server version and Ensure you haven&#8217;t exceeded SQL Server edition limits. Like suppose you are running with SQL Server 2012 standard edition which allows only 64 GB of RAM support and if you have allocated more than 64GB RAM then it will not be useful. Either reduce the max server memory setting to 64 or upgrade your SQL Server to leverage bigger chunk of memory utilization. </li><li>Observe your SQL Server workload. Are you getting this error during a specific time frame or operations? Or Are you getting this error when some job or number of adhoc transactions are increased? Gather these details with the help of memory clerks and DBCC MEMORYSTATUS T-SQL statements. Tune your quires and ensure to not run ad hoc queries in large numbers because their plan is not saved in cache and they have to generate sql plan every time you execute them.</li><li>Collect Memory related counters like SQL Server: Buffer Manager, SQL Server: Memory Manager, Page Life Expectancy etc. You can read attached article to understand <a href="https://techyaz.com/sql-server/performance-tuning/top-10-performance-counters-to-identify-sql-server-memory-pressure/" target="_blank" rel="noreferrer noopener"><strong>Top 10 counters to identify memory pressure</strong></a>.</li><li>Review another sp_configure setting min memory per query.</li><li>You can try clearing cache by running below DBCC commands:<ul><li>DBCC FREESYSTEMCACHE</li><li>DBCC FREESESSIONCACHE</li><li>DBCC FREEPROCCACHE</li></ul></li></ol>



<p>If you still have memory pressure after analyzing and implementing solutions given in above section then you have only two options left and this is given below:</p>



<ol class="wp-block-list"><li>Increase Server memory and accordingly increase max server memory in sp_configure</li><li>Reduce your workload on this SQL Server Instance by offloading or segregating the transactions during off peak hours.</li></ol>
</div></div>



<p>Please comment us about your issue experience and let me know how you have fixed your issue.</p>



<p><em><strong><span class="has-inline-color has-vivid-red-color">Related Articles</span></strong></em><strong><em><span class="has-inline-color has-vivid-red-color">:</span></em></strong></p>



<ul class="wp-block-list"><li><a href="https://techyaz.com/sql-server/performance-tuning/sql-server-error-701-there-is-insufficient-system-memory-to-run-this-query/" target="_blank" rel="noreferrer noopener">How to Fix SQL Server Error 701: There is insufficient system memory to run this query</a></li><li><a href="https://techyaz.com/sql-server/understanding-hybrid-buffer-pool-in-sql-server/" target="_blank" rel="noreferrer noopener">Understanding Hybrid Buffer Pool in SQL Server</a></li><li><a href="https://techyaz.com/interview-questions/sql-server-interview-questions/sql-server-dba-interview-questions-answers/" target="_blank" rel="noreferrer noopener">SQL Server Interview Questions &amp; Answers</a></li></ul>
<p>The post <a href="https://techyaz.com/sql-server/fix-sql-server-error-802-insufficient-memory-in-buffer-pool/">Fix SQL Server Error 802: There is insufficient memory available in the buffer pool.</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/fix-sql-server-error-802-insufficient-memory-in-buffer-pool/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Enable Lock Pages in Memory for SQL Server?</title>
		<link>https://techyaz.com/sql-server/enable-lock-pages-in-memory-sql-server/</link>
					<comments>https://techyaz.com/sql-server/enable-lock-pages-in-memory-sql-server/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Wed, 16 May 2018 09:09:52 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">https://techyaz.com/?p=2332</guid>

					<description><![CDATA[<p>Lock Pages in Memory is a Windows policy that assures the SQL Server or any other application to keep data in physical memory and not page out by windows if it is enabled for that application. This is very useful setting&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/enable-lock-pages-in-memory-sql-server/">How to Enable Lock Pages in Memory for SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Lock Pages in Memory is a Windows policy that assures the SQL Server or any other application to keep data in physical memory and not page out by windows if it is enabled for that application. This is very useful setting that boosts the performance of SQL Server because it prevents SQL Server buffer pool pages from paging out to virtual memory on disk.</p>
<p>If you have highly transactional SQL Server then enabling Lock Pages in Memory will improve SQL Server performance. Always keep in mind that If you are running SQL Server Instance on virtual machine and when you have decided to enable Lock Pages in Memory for SQL Server then you should also consider setting virtual machine’s memory reservation to match the amount of the provision memory. SQL Server Lock Pages in Memory should also be used in conjunction with the Max Server Memory setting to avoid SQL Server taking over all memory on the virtual machine.</p>
<p>You can use Windows Group Policy tool (gpedit.msc) to enable this policy for SQL Server. You must be system administrator to change this policy. We just need to add SQL Server service account to this policy to enable SQL Server Lock Pages in Memory. If you want to enable it for some other application then you can simply add that application’s service account to this policy.</p>
<p>You need to find the correct SQL Server service account either using SQL Server Configuration Manager or using windows services console (services.msc) before going to enable this policy for SQL Server.</p>
<h3><span style="color: #333399;">Enable Lock Pages in Memory</span></h3>
<ol>
<li>First step is to get the service account of the process or application for that we need to enable Lock Pages in Memory. As we have to enable Lock Pages in Memory for SQL Server so we will find SQL Server service account.</li>
</ol>
<ol start="2">
<li>To get the SQL Server service account, you need to either open SQL Server Configuration Manager or you should open windows services console (services.msc). Here you can double click on SQL Server service then you can click at Log on tab. Here, you can see correct service account that is used to run SQL Server.</li>
</ol>
<ol start="3">
<li>Now you have SQL Server service account. Go to <em><strong>Run</strong></em> command and type <em><strong>gpedit.msc</strong></em>.</li>
</ol>
<ol start="4">
<li>You will get <em><strong>Local Group Policy Editor</strong></em> console, expand <em><strong>Computer Configuration</strong></em>, and then expand <em><strong>Windows Settings</strong></em> from left side pane of this window.</li>
</ol>
<ol start="5">
<li>Now, expand <em><strong>Security Settings</strong></em> under Windows Setting folder, and then expand <em><strong>Local Policies</strong></em>.</li>
</ol>
<ol start="6">
<li>Here, you can see three options, now click at <em><strong>User Rights Assignment</strong></em> folder. All policies will be displayed in the right-side pane.</li>
</ol>
<p><img fetchpriority="high" decoding="async" class="size-full wp-image-2333 aligncenter" src="https://techyaz.com/wp-content/uploads/2018/05/1-gpedit-min.jpg" alt="Open Windows Policy Console" width="627" height="529" srcset="https://techyaz.com/wp-content/uploads/2018/05/1-gpedit-min.jpg 627w, https://techyaz.com/wp-content/uploads/2018/05/1-gpedit-min-300x253.jpg 300w" sizes="(max-width: 627px) 100vw, 627px" /></p>
<ol start="7">
<li>Search <em><strong>Lock Pages in Memory</strong></em> policy in right side pane and then double-click on it to open its property window.</li>
</ol>
<ol start="8">
<li>Now another window named <em><strong>Lock pages in memory</strong><strong>  Properties</strong></em> will appear on your screen, click at <em><strong>Add User or Group </strong></em>tab<em><strong>.</strong></em></li>
</ol>
<p><img decoding="async" class="size-full wp-image-2334 aligncenter" src="https://techyaz.com/wp-content/uploads/2018/05/2-Lock-Pages-Memory-min.jpg" alt="Lock Pages in Memory" width="419" height="508" srcset="https://techyaz.com/wp-content/uploads/2018/05/2-Lock-Pages-Memory-min.jpg 419w, https://techyaz.com/wp-content/uploads/2018/05/2-Lock-Pages-Memory-min-247x300.jpg 247w" sizes="(max-width: 419px) 100vw, 419px" /></p>
<ol start="9">
<li>Here, you need to enter the SQL Server service account that you have captured at second step. In the Select Users, Service Accounts, or Groups dialog box, select the SQL Server Service account. Once you add SQL Server Service account then click on Ok button to close that window.</li>
</ol>
<ol start="10">
<li>Now last step is to restart SQL Server Service for this setting to take effect. Now you have enabled SQL Server Lock Pages in memory.</li>
</ol>
<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><em><strong><span style="color: #800000;">Read More:</span></strong></em></p>
<ul>
<li><strong><a href="https://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="https://techyaz.com/sql-server/troubleshooting/top-10-performance-counters-to-identify-sql-server-memory-pressure/" target="_blank" rel="noopener">Top 10 Perfmon Counters to Identify SQL Server Memory Pressure</a></strong></li>
<li><strong><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">SQL Server Error 701 and Error 802: There is Insufficient System Memory to Run this Query</a></strong></li>
<li><strong><a href="https://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>
<p>The post <a href="https://techyaz.com/sql-server/enable-lock-pages-in-memory-sql-server/">How to Enable Lock Pages in Memory for SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/enable-lock-pages-in-memory-sql-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Top Perfmon Counters to Identify SQL Server CPU Bottleneck</title>
		<link>https://techyaz.com/sql-server/performance-tuning/top-perfmon-counters-to-identify-sql-server-cpu-bottleneck/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/top-perfmon-counters-to-identify-sql-server-cpu-bottleneck/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Tue, 01 May 2018 13:39:32 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[bulk import performance]]></category>
		<category><![CDATA[Perfmon Counters]]></category>
		<category><![CDATA[Perfmon CPU Counters]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=2203</guid>

					<description><![CDATA[<p>We should always monitor system resource utilization of our database servers and make sure that these utilizations should not exceed the benchmark ranges of our environment. Today, I will explain about monitoring top perfmon counters for CPU usage. If your&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/top-perfmon-counters-to-identify-sql-server-cpu-bottleneck/">Top Perfmon Counters to Identify SQL Server CPU Bottleneck</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We should always monitor system resource utilization of our database servers and make sure that these utilizations should not exceed the benchmark ranges of our environment. Today, I will explain about monitoring top perfmon counters for CPU usage. If your database server is continuously showing high CPU usage that means you need to look in to top perfmon counters to identify SQL Server CPU bottleneck. You can monitor these performance counter values to detect the CPU pressure.</p>
<p>I have already explained top performance counters to detect Memory and Disk IO bottlenecks in SQL Server in my last articles. Have a look at them (attached below) to get Memory and Disk IO related performance counters and their ideal values for healthy system.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/top-10-performance-counters-to-identify-sql-server-memory-pressure/" target="_blank" rel="noopener">Top 10 Performance Counters to Identify SQL Server Memory Pressure</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>
<p>Generally, CPU bottleneck arises because of either your system has not enough CPUs to process current workload or your transactions or applications are poorly designed that causes the high CPU. To deal with SQL Server CPU pressure, we need to either find the high CPU intensive queries and optimize them or increase the total CPU counts of the database server to handle current workload. There can be multiple reasons for high CPU usage like high recompilations of SQL Queries, OS issues, Query design issues: Sorting Joins, Poor Indexes, Condition Clauses etc. Here, I am going to explain about top perfmon counters to identify SQL Server CPU bottleneck.</p>
<h3><span style="color: #333399;">Perfmon Counters for CPU Usage</span></h3>
<p><img decoding="async" class="size-full wp-image-2204 alignright" src="http://techyaz.com/wp-content/uploads/2018/05/Top-Perfmon-Counters-for-CPU-Usage.png" alt="Top Perfmon Counters for CPU Usage" width="300" height="300" srcset="https://techyaz.com/wp-content/uploads/2018/05/Top-Perfmon-Counters-for-CPU-Usage.png 300w, https://techyaz.com/wp-content/uploads/2018/05/Top-Perfmon-Counters-for-CPU-Usage-150x150.png 150w, https://techyaz.com/wp-content/uploads/2018/05/Top-Perfmon-Counters-for-CPU-Usage-160x160.png 160w, https://techyaz.com/wp-content/uploads/2018/05/Top-Perfmon-Counters-for-CPU-Usage-320x320.png 320w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>Here, I am going to describe about perfmon counters for CPU usage in SQL Server. Ideally, first we should start with looking at CPU usage in Windows Task Manager. If the CPU utilization is continuously going beyond 85%, it means your system is facing CPU bottleneck. Find the list of performance counters to identify SQL Server CPU bottleneck.</p>
<h5><span style="color: #993300;">Processor: % Processor Time </span></h5>
<p>One of the very useful CPU perfmon counter for SQL Server is <em>Processor: % Processor Time.</em> This counter displays the percentage of time CPU spends executing a thread that is not idle. If your system is frequently reaching beyond 85% then it means your system is facing CPU bottleneck. The acceptable value for this counter should be less than 50%.</p>
<h5><span style="color: #993300;">Processor: % User Time</span></h5>
<p>Windows operating system has two modes of processing for any process. One is Kernel mode another one is user mode. This counter shows the percentage of time a process spends executing user processes like SQL Server. If this counter is high it means CPU pressure is because of SQL Server or because of user applications. You should focus to retrieve CPU intensive queries to get the culprit transactions that are causing high CPU pressure. There is no idle value for this counter. You should benchmark each system based on your workload.</p>
<h5><span style="color: #993300;">Processor: % Privilege Time</span></h5>
<p>This counter shows the percentage of time the processor spends on execution of Microsoft Windows kernel commands, such as processing of SQL Server I/O requests. This counter captures the information about kernel mode and indicates towards poor performance of disk subsystems. Monitor DISK IO related performance counters to identify DISK IO bottleneck and if possible, consider installing a faster or more efficient disk subsystem.</p>
<h5><span style="color: #993300;">Processor: % Interrupt Time</span></h5>
<p>This counter <em>Processor: % Interrupt Time </em>tells about the time a processor spends receiving and servicing hardware interruptions during specific sample intervals. This counter indicates a possible hardware issue if the value is greater than 15 percent.</p>
<h5><span style="color: #993300;">System: Processor Queue Length</span></h5>
<p>This is an important perfmon counter to detect CPU bottleneck. This counter gives information about the number of threads waiting for processor time. If value of this counter is greater than zero then this is a sign of CPU bottleneck. We can further check <em>Compilations/sec</em> and <em>Re-Compilations/sec</em>. A high number of compilations and recompilations usually indicates poor reuse of the query plans. This can be fixed by optimizing your queries and stored procedures.</p>
<h5><span style="color: #993300;">System: Calls/sec</span></h5>
<p>Any system would have either software calls or application related calls or hardware related calls. This counter<em> System: Calls/sec</em> metric shows the number of software calls to the operating system service routines per second. Similarly, another CPU perform counter <em>Processor: Interrupts/Sec</em> shows the number of hardware calls to the processor. Both perfmon counters can be used to determine the source of the performance issues. The acceptable values for <em>System: Calls/sec</em> are under 20,000. Higher values might indicate excessive operating system activity caused by software applications.</p>
<h5><span style="color: #993300;">Context Switches/sec</span></h5>
<p>Context Switches occurs when kernel switches processor from one thread to another<em>. </em>The acceptable <em>Context Switches/sec</em> value should be less than 2,000 per processor. If you are observing constant high values of <em>Context Switches/sec</em> and <em>Processor: % Processor Time</em> on your system then this would be a clear sign of processor bottlenecks. Permanent solution to reduce CPU bottleneck is to change the processor to a more powerful one, or add an additional to existing ones.</p>
<p>You might have seen high <em>Context Switches/sec</em> values for systems that are running with multiple SQL Server instances or a system that is hosted other applications along with SQL Server.</p>
<p>Here I have described top perfmon counters for CPU usage 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/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/avoid-database-shrink-operation/" target="_blank" rel="noopener">Understanding Database Shrink Operation and Why should you Avoid it?</a></strong></li>
<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 Error 701: There is Insufficient System Memory to Run this Query</a></strong></li>
<li><strong><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></strong></li>
</ul>
<p>&nbsp;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/top-perfmon-counters-to-identify-sql-server-cpu-bottleneck/">Top Perfmon Counters to Identify SQL Server CPU Bottleneck</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-perfmon-counters-to-identify-sql-server-cpu-bottleneck/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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>SQL Server Error 701: There is Insufficient System Memory to Run this Query</title>
		<link>https://techyaz.com/sql-server/performance-tuning/sql-server-error-701-there-is-insufficient-system-memory-to-run-this-query/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/sql-server-error-701-there-is-insufficient-system-memory-to-run-this-query/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Sat, 28 Apr 2018 11:13:42 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[bulk import performance]]></category>
		<category><![CDATA[Memory Issues]]></category>
		<category><![CDATA[Perfmon Counters]]></category>
		<category><![CDATA[performance tuning]]></category>
		<category><![CDATA[SQL_Server_Memory_Management]]></category>
		<category><![CDATA[Waittypes]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=2180</guid>

					<description><![CDATA[<p>Today I am going to discuss SQL Server memory issues that your database Instance might face during bulk data load or during any memory intensive operations. You may also face insufficient memory issue when you try to execute numerous queries&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/sql-server-error-701-there-is-insufficient-system-memory-to-run-this-query/">SQL Server Error 701: There is Insufficient System Memory to Run this Query</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Today I am going to discuss SQL Server memory issues that your database Instance might face during bulk data load or during any memory intensive operations. You may also face insufficient memory issue when you try to execute numerous queries on large data sets at the same time in SQL Server. In such circumstances, SQL Server throws error 701 or error 802 with error text “<em>There is insufficient system memory to run this query</em>.” Full error descriptions for both error codes are given below.</p>
<p><em><span style="color: #ff0000;">Error 701, Severity: 17, State: 193.</span></em><br />
<em><span style="color: #ff0000;"> There is insufficient system memory to run this query.</span></em></p>
<p>Or</p>
<p><em><span style="color: #ff0000;">Error 802, Severity: 17, State: 20</span></em><br />
<em><span style="color: #ff0000;"> There is insufficient memory available in the buffer pool.</span></em></p>
<h3><span style="color: #333399;">Error 701 or Error 802: Root Cause</span></h3>
<p>If SQL Server is running out of memory and has no more memory available to allocate to its transactions then it will generate SQL Server memory error 701 or error 802. SQL Server Memory pressure or insufficient memory issue can be raised due to huge data load or other memory intensive operations.</p>
<p>We should check <em>DBCC MEMORYSTATUS</em> output to get latest snapshot of current memory status of the SQL Server. This command is very useful in troubleshooting memory issues in SQL Server. You might even have failed to run this DBCC command because system does not have enough memory. You need to reduce some memory pressure by stopping or killing some processes and then try to run this command to gather in depth information about SQL Server memory state.</p>
<p>The transaction that failed due to memory pressure and generates error 701 or error 802 might be or might not be the cause of this error. We should analyze the trends to reach on any conclusion.</p>
<h3><span style="color: #333399;">Solution</span></h3>
<p>There are mainly two reasons behind getting SQL Server memory issues for most of the SQL Server systems. Either your server has less memory to handle the current day to day workload or you are running some of the adhoc transactions that will require more memory for their execution like huge bulk data load, complex reports etc. If your SQL Server is running with insufficient memory during day to day activities then you should seriously evaluate the total workload and propose optimum memory size that can handle your current workload.</p>
<p>If you are planning to run any heavy ad hoc transaction then you should temporary increase the memory that can handle the transaction smoothly or you should run such transactions on a server that are built to handle such loads. You should also consider to reduce the batch size that is optimum for your system.</p>
<p>SQL Server is memory intensive application. We need to plan memory sizing for a server after proper evaluation of server state and overall load that will run on that SQL Server instance. But if you are facing memory issue on one of your SQL Server then first we need to troubleshoot it and find the root cause of this memory pressure. Here I am giving you step by step method to find the actual culprit that are causing the memory issue and possible solutions that can reduce some memory overheads.</p>
<p>First Make sure your SQL Server instance is running on dedicated server and not with other applications. If other applications are also using your database server then make sure they are not eating most of the memory. And, If most of the system memory is taken by other applications then you need to seriously think about migrating those application from this database server.</p>
<p>If you cannot migrate these applications to another server then workaround for such issues are to allocate the maximum memory value to your SQL Server instance. You can do it either by using sp_configure or using GUI. Read attached article to change max memory value for your SQL Server instance.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/sql-server-memory-allocation-min-max-server-memory-configuration/" target="_blank" rel="noopener">Understanding SQL Server Memory Allocation and Role of MIN/MAX Server Memory Configuration</a></strong></li>
</ul>
<p>Next thing you should check is the server memory configuration. Check below SQL Server memory configuration parameters:</p>
<ul>
<li>max server memory</li>
<li>min server memory</li>
<li>min memory per query</li>
</ul>
<p>Notice any unusual settings and fix them as necessary. All above three options have been covered in detain in above attached article.</p>
<p>Now, check the workload in terms of number of concurrent sessions, currently executing queries along with their memory grants. You should also focus on SQL Server transactions that are seeking huge memory values. Look at the transactions and gather a report for high memory intensive operations. Evaluate them and if possible optimize them so that they can take minimum memory.</p>
<ul>
<li><a href="http://techyaz.com/sql-server/resource_semaphore-wait-type/" target="_blank" rel="noopener"><strong>Understanding Memory Wait type Resource_SEMAPHORE and how to fix it?</strong></a></li>
</ul>
<p>You can also run below DBCC commands to free several SQL Server memory caches. This will also help you and make some relief for your current running transactions but in longer run it will not help if your system will need more memory to proceed the transactions.</p>
<ul>
<li>DBCC FREESYSTEMCACHE</li>
<li>DBCC FREESESSIONCACHE</li>
<li>DBCC FREEPROCCACHE</li>
</ul>
<p>Another effective way to look in to memory status is by getting the output of DBCC MEMORYSTATUS command. You would get a good starting point to look in to culprit memory consumers.</p>
<p>We can also start collecting performance monitor counters for memory. Perfmon counters like the value of <em>SQL Server: Buffer Manager\Buffer Cache Hit Ratio, SQL Server: Memory Manager and Page Life Expectancy</em> will be very helpful in identifying memory pressure on SQL Server system. Analyze the trend for these counters and then decide whether issue is coming during some specific operations or system is continuously facing memory pressure.</p>
<p>Based on these analyses you can choose to either increase the system memory, increase the SQL Server memory allocation or reschedule some of the memory specific transactions to the off hours when load is minimum on the system. You can also reduce the batch size of the transaction to reduce the memory pressure. This will be certainly helpful in troubleshooting memory issues.</p>
<p>It is not necessary that your transactions are poorly designed always that is why SQL Server is taking lot of memory to process it. Sometimes even our systems on which SQL Server runs might have problem that end up with memory pressure. So you should consider all these points while fixing any performance issue.<br />
I hope you like this article. Please follow us on 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/sql-server-dmvs/4-different-usages-dbcc-sqlperf-sql-server/" target="_blank" rel="noopener">4 Usages of DBCC SQLPERF in SQL Server</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 Bulk Data Load</a></strong></li>
<li><strong><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></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/overview-on-sql-server-performance-tuning/" target="_blank" rel="noopener">Overview of SQL Server Performance Tuning</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>
<p>&nbsp;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/sql-server-error-701-there-is-insufficient-system-memory-to-run-this-query/">SQL Server Error 701: There is Insufficient System Memory to Run this Query</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-error-701-there-is-insufficient-system-memory-to-run-this-query/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Overview on SQL Server Performance Tuning</title>
		<link>https://techyaz.com/sql-server/performance-tuning/overview-on-sql-server-performance-tuning/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/overview-on-sql-server-performance-tuning/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Jackson]]></dc:creator>
		<pubDate>Thu, 08 Feb 2018 08:26:34 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1765</guid>

					<description><![CDATA[<p>SQL Server Performance Tuning is an important subject and it is essential to implement various measures at regular intervals of time to optimize the scalability and performance of the Server. There are multiple areas which we analyze to understand a&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/overview-on-sql-server-performance-tuning/">Overview on SQL Server Performance Tuning</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>SQL Server Performance Tuning is an important subject and it is essential to implement various measures at regular intervals of time to optimize the scalability and performance of the Server. There are multiple areas which we analyze to understand a performance problem. Here, i will discuss all those areas that are important considering performance tuning. I will not explain them in detail but you will get an idea to start learning performance tuning from DBA standpoint after reading this article.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1771" src="http://techyaz.com/wp-content/uploads/2018/02/SQL-Server-Performance-Tuning.png" alt="SQL Server Performance Tuning" width="560" height="315" srcset="https://techyaz.com/wp-content/uploads/2018/02/SQL-Server-Performance-Tuning.png 560w, https://techyaz.com/wp-content/uploads/2018/02/SQL-Server-Performance-Tuning-300x169.png 300w" sizes="auto, (max-width: 560px) 100vw, 560px" /></p>
<h3><span style="color: #333399;">Server Level Configuration Check</span></h3>
<p>To deal with SQL Server Performance Tuning, it is required to review and check all the server level configuration settings of the SQL Server on periodic basis. Some of these settings may vary depending on the workload and criticality of the application. You can have a look at all the configurational settings by running below command.</p>
<pre><span style="color: #0000ff;"><strong>sp_configure'show advanced options',1
GO
RECONFIGURE
GO
sp_configure
</strong></span></pre>
<h3><span style="color: #333399;">Index Analysis</span></h3>
<p>The role of indexes in SQL Server performance tuning is very crucial. To achieve better Server performance during data retrieval, it is important to create useful indexes. Proper indexing helps in executing tasks with minimal disk Input\ Output operations and fewer system resources.</p>
<p>To implement this approach, it is important to understand how indexes are used by ‘Query Processor’ for executing quick data search operation. Even excessive indexes or poor indexes can harm your database performance so better to analyze the data and query before creating any indexes on your table. Read below articles to understand more on SQL Server Indexes.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/understanding-sql-server-indexes/" target="_blank" rel="noopener">Understanding SQL Server Indexes and difference between Clustered and Nonclustered Indexes</a></strong></li>
</ul>
<h3><span style="color: #333399;">SQL Wait Stat Analysis</span></h3>
<p>“Wait Stat Analysis” is an alternate way to identify the symptoms that cause impact on the Server performance. SQL Server constantly keeps track of the reasons for which execution tasks wait or gets delayed; so to detect the reason, one can refer to the Server logs. You can read more about SQL Server Wait types in below attached articles.</p>
<ul>
<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 and How to get wait type information?</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/reduce-wait-type-preemptive_os_writefilegather/" target="_blank" rel="noopener">How to Reduce PREEMPTIVE_OS_WRITEFILEGATHER Wait type in SQL Server?</a></strong></li>
<li><strong><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></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/resource_semaphore-wait-type/" target="_blank" rel="noopener">Understanding Resource_Semaphore wait type</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/backupbuffer-wait-type/" target="_blank" rel="noopener">How to Fix BACKUPBUFFER Wait Type?</a></strong></li>
</ul>
<h3><span style="color: #333399;">TempDB Space Review</span></h3>
<p>Another way for optimizing Server performance tuning is through proper analysis of the usage as well as empty and occupied space statistics of TempDB database. Make sure that you TempDB database files are placed separately on different drive. If you place user database files and TempDB database files on same drive you might face high disk IO that will cause performance degradation.</p>
<h3><span style="color: #333399;">Index Fragment\ Defragment Operation</span></h3>
<p>This approach can better be implemented through analyzing the indexes to detect the extent of fragmentation and to identify which indexes and databases need to be defragmented for ensuring the smooth performance of these components. You can run SQL Server dashboard report to check which indexes are highly fragmented and need to rebuild or reorganize to improve the performance. Read below articles to understand Index rebuild and Reorganize operation in SQL Server.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/difference-index-rebuild-reorganize/" target="_blank" rel="noopener">Difference between Index Rebuild and Index Reorganize Operation </a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/use-resumable-online-index-rebuild-operation-sql-server/" target="_blank" rel="noopener">How to use Resumable Online Index Rebuild Operation?</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>
</ul>
<h3><span style="color: #333399;">Application/Program Logs</span></h3>
<p>By referring to the “Windows Event Log” or “SQL Server Error Log”, the actual cause for the inappropriate functionality of either database or SQL Server can be detected. This could help in identifying and rectifying the existing errors that lead to files inaccessibility.</p>
<h3><span style="color: #333399;">Backup &amp; Recovery Parameters</span></h3>
<p>For better performance tuning, analyze the backup and recovery settings to ensure if they are implemented appropriately. So that the backup files can be restored successfully in case of any unexpected circumstances.</p>
<h3><span style="color: #333399;">Review Database Files</span></h3>
<p>Review entire database files including primary, secondary as well as log files (MDF, NDF and LDF respectively) to analyze and detect the actual cause that is responsible for the inappropriate functionality of database. Make a practice to keep data and log files on separate drives to reduce the disk IO pressure. You can also analize which data or log file is having highest IO operating, this way you can plan to place that file in a faster disk.</p>
<ul>
<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>
<li><strong><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></strong></li>
</ul>
<h3><span style="color: #333399;">Blocking and Deadlock Detection</span></h3>
<p>Detecting Deadlocks is not a major task but often requires proper understanding and hands-on experience on the concept to implement it in an accurate manner. To implement the task, it is important to understand the locking mechanism along with its resolution. You can also identify if there is poor application design or coding by analyzing blocking and deadlock occurrence. If it occurs frequently, you can seriously think about optimizing your application or T-SQL coding. Identifying blocking issues will also help you in SQL Server performance tuning.</p>
<h3><span style="color: #333399;">Hardware Components</span></h3>
<p>Regular examination test over the various components of the SQL Server machine is required to ensure smooth functioning of all the elements as well as to prevent the adverse circumstances that can take place due to major hardware breakdown.</p>
<h3><span style="color: #333399;">DBCC Implementation</span></h3>
<p>It is very important to understand the nature of Database Console Commands as some of them are very critical and sometimes requires additional attention while execution. Some of these commands include DBCC SRHINKDATABASE, DBCC FREEPROCCACHE, DBCC SHRINKFILE, DBCC REINDEX and DBCC DROPCLEANBUFFER along with some stored procedures such as SP_UPDATESTATS.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/sql-server-dmvs/4-different-usages-dbcc-sqlperf-sql-server/" target="_blank" rel="noopener">4 Usages of DBCC SQLPERF in SQL Server</a></strong></li>
</ul>
<h3><span style="color: #333399;">Conclusion</span></h3>
<p>So, these are some of the major mechanisms of SQL Server Performance Tuning concept and when implemented with proper consideration and attention, help in optimizing the performance of the Server. By executing these actions on regular instance of time; the performance issues with the Server and the incorporated databases can be resolved.</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/overview-on-sql-server-performance-tuning/">Overview on SQL Server Performance Tuning</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/performance-tuning/overview-on-sql-server-performance-tuning/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Should We Clear Wait Statistics Data from DMV sys.dm_os_wait_stats in SQL Server?</title>
		<link>https://techyaz.com/sql-server/performance-tuning/clear-wait-statistics-data-sql-server/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/clear-wait-statistics-data-sql-server/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Thu, 28 Dec 2017 14:46:54 +0000</pubDate>
				<category><![CDATA[DBCC & DMVs]]></category>
		<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server Interview Questions]]></category>
		<category><![CDATA[DBA interview questions]]></category>
		<category><![CDATA[DBCC]]></category>
		<category><![CDATA[dmv]]></category>
		<category><![CDATA[performance tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[wait statistics]]></category>
		<category><![CDATA[Waittypes]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1412</guid>

					<description><![CDATA[<p>Should we clear or reset Performance Wait Statistics Data present in DMV sys.dm_os_wait_stats in SQL Server? The answer to this question is depends on case to case. Ideally, you should not clear your wait statistics data frequently. Best way is Do Not clear wait&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/clear-wait-statistics-data-sql-server/">Should We Clear Wait Statistics Data from DMV sys.dm_os_wait_stats in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Should we clear or reset Performance Wait Statistics Data present in DMV <strong>sys.dm_os_wait_stats </strong>in SQL Server? The answer to this question is depends on case to case. Ideally, you should not clear your wait statistics data frequently. Best way is Do Not clear wait stats data until it is required to gather information for any performance issue. Although, clearing wait stats has no impact on SQL Server performance. It will just remove information related to accumulated wait stats.</p>
<h5><span style="color: #333399;">Should We Clear Wait Stats Data in SQL Server?</span></h5>
<p>We do not recommend to clear the wait stats data frequently because all valuable information about wait statistics will be vanished if you clear them. Always try to capture wait statistics information before clearing wait stats. This way you would have both before and after data. You can use <strong>sys.dm_os_wait_stats</strong> DMV to get the SQL Server wait statistics information.</p>
<p>Generally, we reset or clear wait stats information to capture actual data during a given time duration because this DMV does not show only current data. The DMV sys.dm_os_wait_stats accumulates all the counts and wait times since last time SQL Server started or its stats got cleared by dbcc sqlperf command.</p>
<p>Here I will show you how to clear the SQL Server wait statistics and the difference between data captured before clearing the wait stats and after clearing the wait stats.</p>
<h5><span style="color: #333399;">Get Wait Statistics Data</span></h5>
<p>The DMV sys.dm_os_wait_stats provides essential metrics for diagnosing SQL Server performance problems. This DMV captures all the details like waiting requests counts, signal waits and waiting time since last time SQL Server instance got started or last time you have cleared your wait stats using DBCC SQLPERF command. Run below command to get performance wait stats details of your SQL Server instance.</p>
<pre><strong><span style="color: #008000;">--Get Wait Statistics using DMV sys.dm_os_wait_stats</span>
<span style="color: #0000ff;">SELECT * FROM sys.dm_os_wait_stats
Order by wait_time_ms desc
</span></strong></pre>
<p>You can see the details about all the wait types on your SQL Server instance. You can also see the total wait time in milliseconds. This data is very important if you are dealing with any performance issue but as i discussed above details like total wait time, total waiting tasks counts are the accumulated/incremental values.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1414" src="http://techyaz.com/wp-content/uploads/2017/12/1-Get-wait-stats.jpg" alt="Get SQL Server Wait Stats Data" width="643" height="300" srcset="https://techyaz.com/wp-content/uploads/2017/12/1-Get-wait-stats.jpg 643w, https://techyaz.com/wp-content/uploads/2017/12/1-Get-wait-stats-300x140.jpg 300w" sizes="auto, (max-width: 643px) 100vw, 643px" /></p>
<h5><span style="color: #333399;">Reset or CLEAR Wait Statistics</span></h5>
<p>Now you have captured wait stats information since your SQL Server was started. If you want to get only current waiting task counts or waiting time then you need to reset or clear wait statistics data using dbcc sqlperf command. Run below command to clear all wait stats data on your SQL Server Instance.</p>
<pre><strong><span style="color: #0000ff;">DBCC SQLPERF(“sys.dm_os_wait_stats”, CLEAR)
</span></strong></pre>
<p>You can see I have successfully executed this command in below screenshot.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1415" src="http://techyaz.com/wp-content/uploads/2017/12/2-Clear-wait-stats.jpg" alt="Clear Wait Stats" width="689" height="121" srcset="https://techyaz.com/wp-content/uploads/2017/12/2-Clear-wait-stats.jpg 689w, https://techyaz.com/wp-content/uploads/2017/12/2-Clear-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 information that is showing different than the one showing before clearing wait stats.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1416" src="http://techyaz.com/wp-content/uploads/2017/12/3-Check-wait-stats-after-resetting-wait-stats.jpg" alt="Get wait stats after clearing its older data" width="804" height="283" srcset="https://techyaz.com/wp-content/uploads/2017/12/3-Check-wait-stats-after-resetting-wait-stats.jpg 804w, https://techyaz.com/wp-content/uploads/2017/12/3-Check-wait-stats-after-resetting-wait-stats-300x106.jpg 300w, https://techyaz.com/wp-content/uploads/2017/12/3-Check-wait-stats-after-resetting-wait-stats-768x270.jpg 768w" sizes="auto, (max-width: 804px) 100vw, 804px" /></p>
<p>You can see how you will lose valuable information if you will clear your wait stats without capture its earlier data. This way you can also better analyze your database wait types, waiting tasks to reach on any conclusion to fix the issue.</p>
<p><em><strong><span style="color: #800000;">Related Articles</span></strong></em></p>
<ul>
<li><a href="http://techyaz.com/sql-server/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/">Understanding SQL Server Wait types</a></li>
<li><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></li>
<li><a href="http://techyaz.com/sql-server/resource_semaphore-wait-type/" target="_blank" rel="noopener">Understanding Resource_Semaphore wait type</a></li>
</ul>
<p>Now you understand that we should not reset or clear wait stats frequently because wait stats data is very crucial to deal with any performance issue. You can reset or clear the wait stats but make sure to capture the data before clearing the wait stats. 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/performance-tuning/clear-wait-statistics-data-sql-server/">Should We Clear Wait Statistics Data from DMV sys.dm_os_wait_stats 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/performance-tuning/clear-wait-statistics-data-sql-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Identify Disk Bottleneck in SQL Server using Perfmon Disk Counters</title>
		<link>https://techyaz.com/sql-server/identify-disk-bottleneck-using-perfmon-counters/</link>
					<comments>https://techyaz.com/sql-server/identify-disk-bottleneck-using-perfmon-counters/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Mon, 27 Nov 2017 10:24:45 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Disk Bottleneck]]></category>
		<category><![CDATA[Disk IO]]></category>
		<category><![CDATA[IO]]></category>
		<category><![CDATA[Perfmon Counters]]></category>
		<category><![CDATA[Perfmon Disk Counters]]></category>
		<category><![CDATA[performance tuning]]></category>
		<category><![CDATA[Poor Disk IO]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1261</guid>

					<description><![CDATA[<p>Disk I/O problems are some of the most difficult problems to diagnose and to debug. Here I am going to discuss about perfmon disk counters that will help us in diagnosing the disk related issues. I will segregate the values&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/identify-disk-bottleneck-using-perfmon-counters/">Identify Disk Bottleneck in SQL Server using Perfmon Disk Counters</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Disk I/O problems are some of the most difficult problems to diagnose and to debug. Here I am going to discuss about perfmon disk counters that will help us in diagnosing the disk related issues. I will segregate the values for all disk counters into three categories, <strong>Excellent, Good </strong>and<strong> Poor</strong>. Get your values for these disk counters and compare with these three categories to know how your disk is performing whether your disk is performing excellent, good or it’s required your intervention to improve its performance.</p>
<ol>
<li><strong>Excellent –</strong> You Disk Subsystem is responding perfectly for respective counter.</li>
<li><strong>Good –</strong> You Disk Subsystem is responding fairly for respective counter and you can consider it good considering your workload and other resource utilization.</li>
<li><strong>Poor –</strong> You Disk Subsystem is not responding well for respective counter and it requires your intervention to drill down more to understand the reason behind slowness.</li>
</ol>
<p>If you want to read about CPU and Memory related performance counters then i would suggest you to go through with below attached articles.</p>
<ul>
<li><strong><a href="https://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="https://techyaz.com/sql-server/troubleshooting/top-10-performance-counters-to-identify-sql-server-memory-pressure/" target="_blank" rel="noopener">Top 10 Perfmon Counters to Identify SQL Server Memory Pressure</a></strong></li>
</ul>
<p>Below are the list of important perfmon disk counters that we will be discussing in this article.</p>
<ul>
<li>Average Disk Sec/Read</li>
<li>Average Disk Sec/Write</li>
<li>Average Disk Sec/Transfer</li>
<li>Average Disk Queue Length</li>
<li>Current Disk Queue Length</li>
<li>Disk Read/Sec and Disk Write/Sec</li>
<li>%Disk Time</li>
<li>%Idle Time</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1266" src="http://techyaz.com/wp-content/uploads/2017/11/Perfmon-Disk-IO-Counters.png" alt="Perfmon Disk IO Counters" width="560" height="315" srcset="https://techyaz.com/wp-content/uploads/2017/11/Perfmon-Disk-IO-Counters.png 560w, https://techyaz.com/wp-content/uploads/2017/11/Perfmon-Disk-IO-Counters-300x169.png 300w" sizes="auto, (max-width: 560px) 100vw, 560px" /></p>
<h5><span style="color: #333399;"><strong>Average Disk Sec/Read</strong></span></h5>
<p><strong>Average Disk Sec/Read</strong> is important perfmon disk counter that shows the average time in seconds needed to read data from disk and better explain the disk latency. We can find these counters at the logical and physical disk object level. The value for this counter is generally the number of seconds it takes to do each read. The shorter the time needed to read or write data, the faster the system. If you constantly get this counter value more than 20ms then it means your disk is not performing well.</p>
<p>Your disk performance is:</p>
<ul>
<li><strong>Excellent, </strong>if the value of this counter is less than 6 milliseconds (0.006 sec)</li>
<li><strong>Good</strong>, if the value of this counter is up to 15 milliseconds (0.015 sec)</li>
<li><strong>Poor</strong>, if the value is constantly more than 15 milliseconds (0.015 sec)</li>
</ul>
<h5><span style="color: #333399;"><strong>Average Disk Sec/Write</strong></span></h5>
<p><strong>Average Disk Sec/Write </strong>is also an important counter that shows the average time in seconds needed to write data to disk. that can better explain the disk latency. This counter can be tracked at the logical and physical disk level. The value for this counter is generally the number of seconds it takes to do each read. The shorter the time needed to read or write data, the faster the system. If you constantly get this counter value more than 20ms then it means your disk is not performing well.</p>
<p>Your disk performance is:</p>
<ul>
<li><strong>Excellent, </strong>if the value of this counter is less than 6 milliseconds</li>
<li><strong>Good</strong>, if the value of this counter is up to 15 milliseconds</li>
<li><strong>Poor</strong>, if the value is constantly more than 15 milliseconds.</li>
</ul>
<h5><span style="color: #333399;"><strong>Average Disk Sec/Transfer</strong></span></h5>
<p><strong>Average Disk Sec/Transfer</strong> is a time that measures average latency for read or write operations. If the Average Disk Sec/Transfer value increases, this indicates that the I/O subsystem is not optimally keeping up with the I/O demand. This counter is available under Logical Disk and Physical Disk object. If you are keeping a watch on this counter make sure to have a look at above perfmon disk counters <strong>Average Disk Sec/ Read</strong> and <strong>Average Disk Sec/Write</strong> as well because Average Disk Sec/Transfer is the average of both read and write counters so you need to find out high value is due to read operation or write operation. Below are the values that will tell you whether your disk is performing excellent, good or it is performing slow and requires your intervention to improve its performance.</p>
<p>Your disk performance is:</p>
<ul>
<li><strong>Excellent, </strong>if the value of this counter is less than 6 milliseconds</li>
<li><strong>Good</strong>, if the value of this counter is up to 15 milliseconds</li>
<li><strong>Poor</strong>, if the value is constantly more than 15 milliseconds.</li>
</ul>
<h5><span style="color: #333399;"><strong>Average Disk Queue Length</strong></span></h5>
<p><strong>Average Disk Queue Length</strong> counter shows you the average number of read and write requests that were queued on the selected physical disk. If this value is exceeding its threshold frequently then we should also look at other perfmon disk counters <strong>Average Disk Read Queue Length</strong> and <strong>Average Disk Write Queue Length</strong>. This way you can diagnose whether Average Disk Queue Length is high due to high read or high write operation. The recommended value for this counter is less than 2 per individual disk so if you have multiple disks then your recommended value for Average disk queue length would be twice the no of disks.</p>
<p><strong>Be careful</strong> when using thresholds of 2 with SQL Server and SANs.  This value can be much higher than 2 if you have multiple disks.  Let’s say you have 6 drives and Average disk queue length counter is showing around 12, then you should consider your Average disk queue length value 9/6 = 1.5 not 9.</p>
<p>Your disk performance is:</p>
<ul>
<li><strong>Excellent, </strong>if the value of this counter is less than 1.5 per drive.</li>
<li><strong>Good</strong>, if the value of this counter is up to 2 per drive.</li>
<li><strong>Poor</strong>, if the value is constantly more than 2 per drive,</li>
</ul>
<h5><span style="color: #333399;"><strong>Current Disk Queue Length</strong></span></h5>
<p><strong>Current Disk Queue Length</strong> is the number of disk requests that are currently waiting as well as requests currently being serviced. The difference between average disk queue length and current queue length is CDQL tells current load whereas ADQL tells load during a given time frame. The Current Disk Queue Length metric in Windows Performance Monitor is available for both physical and logical disk. The Current Disk Queue Length value should be less than 2 per disk.</p>
<p>Your disk performance is:</p>
<ul>
<li><strong>Excellent, </strong>if the value of this counter is less than 1.5 per drive.</li>
<li><strong>Good</strong>, if the value of this counter is up to 2 per drive.</li>
<li><strong>Poor</strong>, if the value is constantly more than 2 per drive.</li>
</ul>
<h5><span style="color: #333399;"><strong>Disk Read/Sec and Disk Write/Sec</strong></span></h5>
<p><strong>Disk Reads/Sec</strong> and <strong>Disk Writes/Sec</strong> show you the number of read and write operations happening per second on the disk. If you want to set the benchmark for disk capacity then you can determine it by gradually increasing the load on the system.</p>
<p>Your disk performance is:</p>
<ul>
<li><strong>Excellent, </strong>if the value of this counter is less than 75% of total disk capacity.</li>
<li><strong>Good</strong>, if the value of this counter is up to 85% of total disk capacity.</li>
<li><strong>Poor</strong>, if the value is constantly more than 85% of total disk capacity.</li>
</ul>
<h5><span style="color: #333399;"><strong>%Disk Time</strong></span></h5>
<p><strong>%Disk Time</strong> counter tells how busy the disk is in performing read and write operations. You can see its values normal even your disk has serious disk performance issue. You should compare its value with current/average disk queue length before reaching on any conclusion about disk issue.</p>
<p>Your disk performance is:</p>
<ul>
<li><strong>Excellent, </strong>if the value of this counter is less than 75% of total disk capacity.</li>
<li><strong>Good</strong>, if the value of this counter is up to 85% of total disk capacity.</li>
<li><strong>Poor</strong>, if the value is constantly more than 85% of total disk capacity.</li>
</ul>
<h5><span style="color: #333399;"><strong>%Idle Time</strong></span></h5>
<p><strong>%Idle Time</strong> measures the percentage of time the disk was idle during the sample interval. The disk is idle when it’s not processing read and write requests. If you are constantly getting its value less than 40% then you can either move some applications from your machine to another machine if you are running other applications as well apart from SQL Server or You can change the current disk system with a faster disk system.</p>
<p>Your disk performance is:</p>
<ul>
<li><strong>Excellent, </strong>if the value of this counter is greater than 60% of total disk capacity.</li>
<li><strong>Good</strong>, if the value of this counter is greater than 50% of total disk capacity.</li>
<li><strong>Poor</strong>, if the value is constantly less than 40% of total disk capacity.</li>
</ul>
<p><span style="color: #800000;"><strong><em>Related Articles:</em></strong></span></p>
<ul>
<li><strong><a href="https://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="https://techyaz.com/sql-server/troubleshooting/sql-server-encountered-32-occurrences-requests-taking-longer-15-seconds-complete/" target="_blank" rel="noopener">How to fix IO error: SQL Server has encountered N occurrence(s) of I/O requests taking longer than 15 seconds to complete.</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/improve-sql-server-bulk-data-import-performance/" target="_blank" rel="noopener">Improving Bulk Data Load Performance in SQL Server</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/async_io_completion-wait-type/" target="_blank" rel="noopener">Understanding ASYNC_IO_COMPLETION Wait Type</a></strong></li>
</ul>
<p>I hope you like this article. Please follow our <a href="https://www.facebook.com/Techyaz/" target="_blank" rel="noopener">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/identify-disk-bottleneck-using-perfmon-counters/">Identify Disk Bottleneck in SQL Server using Perfmon Disk Counters</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/identify-disk-bottleneck-using-perfmon-counters/feed/</wfw:commentRss>
			<slash:comments>1</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>How to Improve SQL Server Bulk Data Import Performance?</title>
		<link>https://techyaz.com/sql-server/performance-tuning/improve-sql-server-bulk-data-import-performance/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/improve-sql-server-bulk-data-import-performance/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Wed, 08 Nov 2017 07:24:07 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Auto shrink]]></category>
		<category><![CDATA[autogrow]]></category>
		<category><![CDATA[autogrowth setting]]></category>
		<category><![CDATA[Autoshrink]]></category>
		<category><![CDATA[batch size]]></category>
		<category><![CDATA[bulk data load]]></category>
		<category><![CDATA[bulk import]]></category>
		<category><![CDATA[bulk import performance]]></category>
		<category><![CDATA[bulk insert]]></category>
		<category><![CDATA[data file]]></category>
		<category><![CDATA[data file autogrow]]></category>
		<category><![CDATA[data load]]></category>
		<category><![CDATA[database property]]></category>
		<category><![CDATA[HowTO]]></category>
		<category><![CDATA[IFI]]></category>
		<category><![CDATA[Instant File Initialization]]></category>
		<category><![CDATA[log_files]]></category>
		<category><![CDATA[maxdop]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1108</guid>

					<description><![CDATA[<p>I am working on a project where we are migrating Oracle databases to SQL Server for SAP applications. We are using SAP migration tools to migrate these databases and we are not using SSMA for Oracle in this migration. These&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/improve-sql-server-bulk-data-import-performance/">How to Improve SQL Server Bulk Data Import Performance?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I am working on a project where we are migrating Oracle databases to SQL Server for SAP applications. We are using SAP migration tools to migrate these databases and we are not using SSMA for Oracle in this migration. These databases were very big in size so we faced some performance issues during data load. Here I will explain how to avoid such performance issues and speed up SQL Server Bulk Data Import Performance.</p>
<p>Let me first give you some background about SAP migration tool like how it works. SAP Migration tool first captures every related information along with data and creates an export file that needs to be copied to the target location or server and then we perform bulk data import with the help of SAP migration tool. Bulk data import or data load will be done locally and not over network.</p>
<p>When we ran SAP migration tools to capture all details, a dump file was created that we have copied to the SQL Server box. We had approx. 900GB of data that needs to be loaded into SQL Server database. When we performed SQL Server data load using SAP migration tools with standard settings, it took around 14 hrs. to complete the bulk data import.  As 14 hrs. was very long time so we decided to work on reducing the total time taken by import process.</p>
<p>We made some changes from both sides application as well as SQL Server database side. SQL Server data load time has reduced drastically to around little more than 6 hours post these change implementations. Here, I am explaining each parameter that we have configured from database side just for this bulk data import.</p>
<p><span style="color: #800000;"><strong>NOTE:</strong> </span>Make sure to revert these changes as per your application/vendor best practices post this bulk data import for OLTP/normal operations. We are changing value considering Data Load only.</p>
<p><img loading="lazy" decoding="async" class="alignleft wp-image-1109 size-medium" src="http://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import-300x169.jpg" alt="Speed up bulk data Import" width="300" height="169" srcset="https://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import-300x169.jpg 300w, https://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import-768x432.jpg 768w, https://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import-1024x576.jpg 1024w, https://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import.jpg 1280w" sizes="auto, (max-width: 300px) 100vw, 300px" /></p>
<p>It is important to understand the factors that affect bulk data import performance. To speed up the data load, you need to look into below configuration options from DBA standpoint.</p>
<h5><span style="color: #000080;"><strong>Auto Grow</strong></span></h5>
<p><strong> </strong>Autogrow settings can be used to automate SQL Server database file growth. This is very useful property but this can degrade your bulk import performance or data load operations. Read attached article to<strong> <a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">understand SQL Server Autogrow setting</a> </strong>in detail.</p>
<p>Autogrow setting increment must be large enough to avoid the performance penalties.  If you set default or small value during bulk import or data load, database engine will have to perform data file autogrow operation every time the file will be filled with data till maximum size limit. More autogrow operation will take more resources like IO, CPU etc and time to complete the data load transaction.</p>
<p>The exact value for this setting should be based on data growth. You should not be left autogrow in percentage value rather you should use some value in MBs. A general rule of thumb is to set your autogrow setting to about one-eighth the size of the file. Please read attached article to understand <strong><a href="https://techyaz.com/sql-server/troubleshooting/manage-transaction-log-file-during-data-load/" target="_blank" rel="noopener">how to manage transaction log files during huge data load</a>.</strong></p>
<p>I would suggest keeping database size as much as you are expecting your database will grow to avoid autogrow operation. If you are aware that your database size will be 900 GB post data load, you should set your database size to 900 GB before starting the data load. This will improve the bulk import performance. Make sure to enable IFI (Instant File Initialization) for your SQL Server instance to reduce total time SQL Server takes to set the database size.</p>
<h5><span style="color: #000080;"><strong>Instant File Initialization</strong></span></h5>
<p>As I suggested in above point, Turn IFI (Instant File Initialization) ON to speed up AutoGrow process. If you set a considerable large value to autogrow settings, it will take some time to increase the size by zeroing the disk address. IFI speeds up this process and allow us to create enormous size of data files in quick way. Read attached article to learn more about<strong> <a href="https://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">IFI (Instant File Initialization) and how it will speed up autogrow or data load operation</a></strong>. You will also learn how to enable IFI for your SQL Server instance in this attached article.</p>
<h5><span style="color: #000080;"><strong>Auto Shrink</strong></span></h5>
<p>AutoShrink is very costly operation that should be always OFF even during your daily and normal operations. Turn it OFF immediately. Make sure your disk has enough space to sustain during bulk operations or data load. Repeatedly shrinking and growing the data files will cause file-system level fragmentation, which can slow down performance. It also takes lot of CPU and IO. Read attached article to know<strong> <a href="https://techyaz.com/sql-server/always-turn-off-database-auto-shrink/" target="_blank" rel="noopener">why you should always keep Auto_Shrink off</a>.</strong></p>
<h5><span style="color: #000080;"><strong>Reduce Logging</strong></span></h5>
<p>Change <strong><a href="https://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">recovery model</a></strong> to SIMPLE or BULK-LOGGED to reduce the logging operations. The simple recovery model minimally logs most bulk operations. For a database under the full recovery model, all row-insert operations that are performed during bulk import are fully logged in the transaction log.</p>
<p>For large data imports, this can cause the transaction log to fill rapidly. For bulk-import operations, minimal logging is more efficient than full logging and reduces the possibility that a bulk-import operation will fill the log space. To minimally log a bulk-import operation on a database that normally uses the full recovery model, you can first switch the database to the bulk-logged recovery model. After bulk importing the data, switch the recovery model back to the full recovery model.</p>
<h5><span style="color: #000080;"><strong>Auto_Update_Statistics</strong></span></h5>
<p>Auto_Update_Statistics is very useful property that should be set to ON during normal business operations but here I would suggest turning it off during huge data load or bulk import operations. Updating the statistics also takes resources from the system. This can lead to performance issues when you are doing bulk data. It’s important to keep up-to-date statistics for the optimizer to use, but here we will turn it off and once data load or bulk data inserts will be performed, we will again enable it.</p>
<h5><span style="color: #000080;"><strong>Auto_Create_Statistics</strong></span></h5>
<p>This should be OFF because creating statistics also takes resources from the system that can degrade the overall bulk import performance. Make sure to enable it post data load or bulk inserts operation.</p>
<h5><span style="color: #000080;"><strong>Parallelism – MAXDOP</strong></span></h5>
<p>SAP suggests setting MAXDOP value to 1 during normal business operation so we had this value during first data load that took around 14 hrs. We had assigned half of the CPU cores for the parallel processes during data load and bulk import operations. I believe MAXDOP has contributed significant role in reducing total data load time. Make sure to revert this change to its original value as per your application best practices.</p>
<p>You can change MAXDOP settings either using <strong>sp_configure</strong> command or using GUI in SSMS by launching SQL Server Instance property window.</p>
<h5><span style="color: #000080;"><strong>Using Batches</strong></span></h5>
<p>Make sure to use an optimum batch size that will increase the bulk data import performance. Importing a large set of data as a single batch can be problematic, so bcp and BULK INSERT let you import data in a series of batches, each of which is smaller than the data file. Each batch is imported and logged in a separate transaction, and after a given transaction is committed, the rows imported by that transaction are committed. If the operation fails, only rows imported from the current batch are rolled back, and you can resume importing data starting at the beginning of the failed batch rather than at the beginning of the data file.</p>
<p>I hope you like this article. Please follow us 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/performance-tuning/improve-sql-server-bulk-data-import-performance/">How to Improve SQL Server Bulk Data Import Performance?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/performance-tuning/improve-sql-server-bulk-data-import-performance/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Why Should You Always Turn Off Database Auto Shrink Property?</title>
		<link>https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Wed, 27 Sep 2017 12:27:25 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Auto shrink]]></category>
		<category><![CDATA[Autoshrink]]></category>
		<category><![CDATA[database property]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=979</guid>

					<description><![CDATA[<p>SQL Server Auto Shrink is database property that allow database engine to automatically shrink database files if its value set to ON/True. Shrinking a database is not a good practice because it is very expensive operation in terms of I/O,&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/">Why Should You Always Turn Off Database Auto Shrink Property?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>SQL Server Auto Shrink</strong> is database property that allow database engine to automatically shrink database files if its value set to ON/True.<strong> <a href="https://techyaz.com/sql-server/avoid-database-shrink-operation/" target="_blank" rel="noopener">Shrinking a database is not a good practice</a> </strong>because it is very expensive operation in terms of I/O, CPU usage, locking and transaction log generation. Database auto shrink in SQL Server also causes your Indexes to be fragmented because it runs frequently.</p>
<p>Database Auto Shrink or Manual shrink operation runs at database file level. It is not recommended to shrink your <a href="https://techyaz.com/sql-server/understanding-sql-server-data-files-pages-extents/" target="_blank" rel="noopener">data files</a> except in case of the few exceptions like data deletion.  You can run shrink operation if you have deleted some portion of the data to reclaim that space. As this shrink operation can cause index fragmentation so make sure to rebuild your fragmented indexes post performing the shrink operation. Shrinking the <a href="https://techyaz.com/sql-server/understanding-transaction-log-architecture/" target="_blank" rel="noopener">log file</a> may be necessary in some cases if your log file is full and need to clear some space. However, <a href="https://techyaz.com/sql-server/get-total-virtual-log-files/" target="_blank" rel="noopener">shrinking the log file</a> should not be part of any regular maintenance activity and should be manually done whenever it will require.</p>
<p>It is always recommended to never run shrink operation as part of maintenance activity even you should avoid running shrink operation manually if you are doing it. If it is needed to run shrink operation, make sure rebuild your indexes. You should always turn off SQL Server Auto Shrink  for all databases to avoid any future performance issue on your database. By default, SQL Server keeps auto shrink turn off on SQL Server instances.</p>
<p>There will be a bad impact on performance if you turn on database auto shrink and <a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">autogrowth settings</a> together for any database. Most of the database files have some value to autogrowth setting enabled for the databases or we set the database size to the optimum value keeping some room in the data files to grow and avoid frequent auto growth events. If we will enable SQL Server auto shrink property for such databases, it will shrink the data files and reclaim the free space that we have kept intentionally to avoid autogrow events. In that case, both operations will be performed frequently auto growth and then SQL auto shrink that ultimately lead to the system level fragmentation which causes severe performance issue as well.</p>
<p>So in short, <strong>Autoshrink should not be turned on</strong> for any databases. This is bad for several reasons that I have concluded in below points.</p>
<ol>
<li>Database Auto Shrink or Manual Shrink causes index fragmentation that will reduce the database performance.</li>
<li>Shrink operation takes lot of IO and CPU resources. If the server is already pushing the limits of the IO subsystem, running shrink may push it over, causing long disk queue lengths and possibly IO timeouts.</li>
<li>Repeatedly shrinking and growing the data files will cause file-system level fragmentation, which can slow down performance. It wastes a huge amount of resources, basically running the shrink algorithm for no reason.</li>
<li>If you combine the <a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">autogrow</a> and autoshrink options, you might create unnecessary overhead. Make sure that the thresholds that trigger the grow and shrink operations will not cause frequent up and down size changes. So Autogrow and Autoshrink together can seriously reduce your system performance.</li>
<li>SQL Server Auto Shrink and autogrow settings must be carefully evaluated by a trained Database Administrator (DBA); they must not be left unmanaged.</li>
</ol>
<p>Autoshrink doesn&#8217;t work like if the threshold is hit, auto shrink SQL Server operation will start to reclaim space. It uses round robin method to shrink databases if you have multiple databases are set to use auto shrink. SQL Server shrinks a database if needed. Then, it waits several minutes before checking the next database that is configured for auto shrink so your database will need to wait for his turn to execute auto shrink operation.</p>
<h3><span style="color: #003366;">How to Enable or Disable Auto Shrink in SQL Server?</span></h3>
<p>We can turn on or off database auto shrink SQL Server configuration using GUI and T-SQL both ways. Both are easiest method. Let us first start with GUI method.</p>
<p><strong>Right click</strong> on your database for which you want to enable or disable auto shrink and choose <strong>Properties</strong>. You will get below <strong>Database Properties</strong> window. Click on <strong>Options</strong> from left side pane of this window. You can see <strong>Auto Shrink</strong> option is showing in right side pane. If you want to turn it on, click on drop down of this option and select <strong>True</strong>.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-982" src="http://techyaz.com/wp-content/uploads/2017/09/1-autoshrink.jpg" alt="Enable or Disable Database Auto Shrink" width="709" height="635" srcset="https://techyaz.com/wp-content/uploads/2017/09/1-autoshrink.jpg 709w, https://techyaz.com/wp-content/uploads/2017/09/1-autoshrink-300x269.jpg 300w" sizes="auto, (max-width: 709px) 100vw, 709px" /></p>
<p>Below is the T-SQL code to enable or disable the Auto_Shrink option for any database. Change the database name with your database name and execute it.</p>
<div class="codediv">
<pre><strong><span style="color: #008000;">--Set Auto Shrink ON or True</span>
<span style="color: #0000ff;">ALTER DATABASE TechYaz SET AUTO_SHRINK ON</span>
<span style="color: #008000;">--Set Auto Shrink OFF or False</span>
<span style="color: #0000ff;">ALTER DATABASE TechYaz SET AUTO_SHRINK OFF
</span></strong></pre>
</div>
<p>I hope you like this article. Please follow us on our <a href="https://www.facebook.com/Techyaz/">facebook page</a> and on <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p><span style="color: #000080;"><strong>Reference :</strong></span> <a href="https://support.microsoft.com/en-in/help/2160663/recommendations-and-guidelines-for-setting-the-auto-shrink-database-op" target="_blank" rel="noopener">AUTO_SHRINK database option in SQL Server</a></p>
<p><em><span style="color: #800000;"><strong>Read More:</strong></span></em></p>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/avoid-database-shrink-operation/" target="_blank" rel="noopener">Should We Shrink SQL Server Databases or Files?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">Understanding AutoGrowth settings and its impact on Performance</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/sql-server-administration/understanding-sql-server-backup-databases-availability-group/" target="_blank" rel="noopener">SQL Server Backups for AlwaysOn Availability Databases</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">What is Instant File Initialization and how to enable it?</a></strong></li>
</ul>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/">Why Should You Always Turn Off Database Auto Shrink Property?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Understanding Database Autogrowth in SQL Server</title>
		<link>https://techyaz.com/sql-server/performance-tuning/understanding-database-autogrowth-sql-server/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/understanding-database-autogrowth-sql-server/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Tue, 26 Sep 2017 12:43:10 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[autogrow]]></category>
		<category><![CDATA[autogrowth setting]]></category>
		<category><![CDATA[data file autogrow]]></category>
		<category><![CDATA[database property]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=970</guid>

					<description><![CDATA[<p>We use SQL Server database Autogrowth setting to automate database file growth. This property is very helpful if you use it carefully with proper planning. But there can be a negative performance impact on your database if you don’t give attention&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/understanding-database-autogrowth-sql-server/">Understanding Database Autogrowth in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We use SQL Server database <strong>Autogrowth</strong> setting to automate database file growth. This property is very helpful if you use it carefully with proper planning. But there can be a negative performance impact on your database if you don’t give attention on it and leave it with default values. If you have too many autogrow events in your database, it can degrade the overall performance of the database. Below are the points that you can consider to reduce the autogrow events in a database to improve performance.</p>
<h3><span style="color: #003366;">Set Optimum Database Size</span></h3>
<p>Your database should have enough size that it never grows and if it grows make sure that <a href="https://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">Instant file initialization</a> should be enabled on that SQL Server Instance. <strong>Autogrowth</strong> is an option that should be used to avoid unexpected scenarios of space issues in <a href="https://techyaz.com/sql-server/understanding-sql-server-data-files-pages-extents/" target="_blank" rel="noopener">database files</a>. You should plan your database size in a way that can minimize the use of autogrowth setting. You should figure out how big your database will be over the time and set the database size to that value. Analyze database size on every few months to adjust the size if it requires to increase. This way you can minimize autogrow events to be performed on your database files.</p>
<h3><span style="color: #003366;">Resize Database Autogrowth in SQL Server</span></h3>
<p>Auto growth events are expensive operations that slow down the performance of your database because whenever an auto-growth event is performed, SQL Server holds up database processing. This equates to slower response time for those SQL commands that are being processing against the database that is growing.</p>
<p>If you run a large transaction that requires the log to grow, other transactions that require a write to the <a href="https://techyaz.com/sql-server/understanding-transaction-log-architecture/" target="_blank" rel="noopener">transaction log</a> will also have to wait until the autogrow operation completes. If your database is performing frequent autogrow events, then you have a good scope of performance improvement by proper resizing the database autogrowth settings that will reduce the number of autogrow events to be occurred.</p>
<p>Another negative side of autogrowth is the disk fragmentation. The more autogrow events you have the more physical fragmentation you will have. When your database is physically fragmented, it will take more time for SQL Server to read that databases. To avoid the issues associated with auto-growth events you need to minimize the number of its occurrence.</p>
<p><span style="color: #4d4545;"><strong><em>Change Default Autogrowth Settings</em></strong></span></p>
<p>As per my experience, never leave your database files with the default autogrowth settings. The autogrowth default value for data files is 1MB and log files is 10% of total size of the log file. These autogrowth values are inherited from model database. You can change the autogrowth size of each database file of model database that will apply on all databases we create on this SQL Server Instance.</p>
<p><strong>For example:</strong> You can change autogrow settings from default value that is 1MB to <strong>one-eighth</strong> of the database file size. This will again reduce the total number of autogrow events of the database. Make sure that Instant file initialization should be enabled on that SQL Server Instance.</p>
<h3><span style="color: #003366;">Monitoring</span></h3>
<p>If you know your database growth pattern, then set autogrowth per that growth. If you don’t have any idea about your future database growth, then you should proactively monitor database file sizes and their autogrowth events for a week or month and then set it per the growth pattern. We should also proactively monitor database growth histories for all databases to avoid any future outages due to disk or database file full.</p>
<p>You can analyze database disk usage dashboard report to get the number of times autogrowth event has occurred for your database files. I have explained this later in this article.</p>
<h3><span style="color: #003366;">Best Practices for Database Autogrowth in SQL Server</span></h3>
<p>You can improve the database performance and can manage the disk space utilization by focusing on below four points. This will also reduce the number of Autogrowth events to be occurred in the database files.</p>
<ol>
<li>Analyze your database growth pattern and set optimum size of database with the analyzed growth settings. Your database should have enough size that it never grows and if it grows make sure that<strong> <a href="https://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">Instant file initialization should be enabled on that SQL Server Instance</a></strong>.  This will drastically reduce the SQL Server Autogrowth events in day to day life.</li>
<li>Proactively monitor database file sizes and their autogrowth events. This helps you to analyze the growth pattern of database files and avoid fragmentation.</li>
<li>Consider defragmenting your database file system if you have lot of auto-growth events occurred on your databases.</li>
<li>Never leave your database autogrowth with default values, change it as per growth pattern that you analyzed over time.</li>
<li>Avoid using autogrowth in percentage, rather give a specific amount of size in MB/GB. Microsoft suggests to set your autogrow setting to about one-eighth the size of the file and test it before deploying on PROD.</li>
<li>Turn on the &lt;MAXSIZE&gt; setting for each file to prevent any one file from growing to a point where it uses up all available disk space.</li>
<li>The growth increment of your transaction log must be large enough to stay ahead of the needs of your transaction units. Even with autogrow turned on, you can receive a message that the transaction log is full, if it cannot grow fast enough to satisfy the needs of your query.</li>
</ol>
<h3><span style="color: #003366;">Change Database Autogrowth in SQL Server?</span></h3>
<p>You can run below command to change the autogrowth value of any database file.</p>
<pre><strong><span style="color: #008000;">--Pass logical filename of your database file for under NAME section.</span>
<span style="color: #0000ff;">ALTER DATABASE [Techyaz] MODIFY FILE ( NAME = N'Techyaz_Data', FILEGROWTH = 10000KB )
</span></strong></pre>
<p>You can also change the autogrowth settings using GUI in SSMS. Launch the database property window. Click on files tab from left side pane and then on the three dots (…) that are showing besides every database file. You can see this window in below screenshot.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-974" src="http://techyaz.com/wp-content/uploads/2017/09/1-autogrowth.jpg" alt="Autogrowth Settings" width="707" height="627" srcset="https://techyaz.com/wp-content/uploads/2017/09/1-autogrowth.jpg 707w, https://techyaz.com/wp-content/uploads/2017/09/1-autogrowth-300x266.jpg 300w" sizes="auto, (max-width: 707px) 100vw, 707px" /></p>
<h3><span style="color: #003366;">How to View Total Number of Autogrow Events Occurred on a Database?</span></h3>
<p>You can find the number of autogrowth events occurred for your database by running “Disk Usage” dashboard report. Right click on your database for which you want to see total number of autogrowth events. Choose “Reports” and then select “Disk Usage” as shown in below image.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-973" src="http://techyaz.com/wp-content/uploads/2017/09/2-dashboard-report.jpg" alt="Open dashboard Report" width="847" height="299" srcset="https://techyaz.com/wp-content/uploads/2017/09/2-dashboard-report.jpg 847w, https://techyaz.com/wp-content/uploads/2017/09/2-dashboard-report-300x106.jpg 300w, https://techyaz.com/wp-content/uploads/2017/09/2-dashboard-report-768x271.jpg 768w" sizes="auto, (max-width: 847px) 100vw, 847px" /></p>
<p>You will get below dashboard report for disk usage. You can see all details regarding space usage. Auto growth events are also captured in the same report. I have highlighted those entries in below screenshot.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-972" src="http://techyaz.com/wp-content/uploads/2017/09/3-dashboard-report.jpg" alt="disk usage dashboard Report" width="841" height="429" srcset="https://techyaz.com/wp-content/uploads/2017/09/3-dashboard-report.jpg 841w, https://techyaz.com/wp-content/uploads/2017/09/3-dashboard-report-300x153.jpg 300w, https://techyaz.com/wp-content/uploads/2017/09/3-dashboard-report-768x392.jpg 768w" sizes="auto, (max-width: 841px) 100vw, 841px" /></p>
<p>Once you expend the plus<strong> +</strong> sign, you can see total number of autogrow events that have been occurred for your database. You can count the total numbers and total space as well. Based on this analysis you can alter your autogrowth settings to the optimum value that will reduce that much numbers as it is showing here.<br />
<img loading="lazy" decoding="async" class="aligncenter size-full wp-image-971" src="http://techyaz.com/wp-content/uploads/2017/09/4-autogrowth-events.jpg" alt="database autogrowth events" width="787" height="523" srcset="https://techyaz.com/wp-content/uploads/2017/09/4-autogrowth-events.jpg 787w, https://techyaz.com/wp-content/uploads/2017/09/4-autogrowth-events-300x199.jpg 300w, https://techyaz.com/wp-content/uploads/2017/09/4-autogrowth-events-768x510.jpg 768w" sizes="auto, (max-width: 787px) 100vw, 787px" /><br />
I hope you like this article. Please follow us on our <a href="https://www.facebook.com/Techyaz/">facebook page</a> and on <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p><span style="color: #000080;"><strong>Reference:</strong> <a href="https://support.microsoft.com/en-in/help/315512/considerations-for-the-autogrow-and-autoshrink-settings-in-sql-server" target="_blank" rel="noopener">MSDN Article based on Autogrowth</a></span></p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/understanding-database-autogrowth-sql-server/">Understanding Database Autogrowth 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/performance-tuning/understanding-database-autogrowth-sql-server/feed/</wfw:commentRss>
			<slash:comments>1</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 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>
	</channel>
</rss>
