<?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>TempDB &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/tempdb/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Wed, 28 Feb 2018 03:33:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: Optimize the Performance of TempDB</title>
		<link>https://www.dbrnd.com/2018/03/sql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd/</link>
					<comments>https://www.dbrnd.com/2018/03/sql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 09 Mar 2018 16:16:11 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Multiple data files]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[Temp Table]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[TempDB Performance]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4256</guid>

					<description><![CDATA[<div><img width="679" height="452" src="https://www.dbrnd.com/wp-content/uploads/2017/12/SQL-RAM-Performance-679x452.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQL RAM Performance" decoding="async" fetchpriority="high" srcset="https://www.dbrnd.com/wp-content/uploads/2017/12/SQL-RAM-Performance-679x452.jpg 679w, https://www.dbrnd.com/wp-content/uploads/2017/12/SQL-RAM-Performance-850x566.jpg 850w, https://www.dbrnd.com/wp-content/uploads/2017/12/SQL-RAM-Performance.jpg 959w" sizes="(max-width: 679px) 100vw, 679px" /></div>The Database Administrator must know something about the best configuration of TempDB. A general advice is, try to avoid the use of TempDB by creating temp tables. But TempDB also stores other information related to query execution, internal sort operation, overflow memory data. You should keep your eye open for TempDB otherwise it degrades the [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="679" height="452" src="https://www.dbrnd.com/wp-content/uploads/2017/12/SQL-RAM-Performance-679x452.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQL RAM Performance" decoding="async" srcset="https://www.dbrnd.com/wp-content/uploads/2017/12/SQL-RAM-Performance-679x452.jpg 679w, https://www.dbrnd.com/wp-content/uploads/2017/12/SQL-RAM-Performance-850x566.jpg 850w, https://www.dbrnd.com/wp-content/uploads/2017/12/SQL-RAM-Performance.jpg 959w" sizes="(max-width: 679px) 100vw, 679px" /></div><p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd%2F&amp;linkname=SQL%20Server%3A%20Optimize%20the%20Performance%20of%20TempDB" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd%2F&amp;linkname=SQL%20Server%3A%20Optimize%20the%20Performance%20of%20TempDB" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd%2F&amp;linkname=SQL%20Server%3A%20Optimize%20the%20Performance%20of%20TempDB" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd%2F&amp;linkname=SQL%20Server%3A%20Optimize%20the%20Performance%20of%20TempDB" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd%2F&amp;linkname=SQL%20Server%3A%20Optimize%20the%20Performance%20of%20TempDB" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd%2F&amp;linkname=SQL%20Server%3A%20Optimize%20the%20Performance%20of%20TempDB" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd%2F&#038;title=SQL%20Server%3A%20Optimize%20the%20Performance%20of%20TempDB" data-a2a-url="https://www.dbrnd.com/2018/03/sql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd/" data-a2a-title="SQL Server: Optimize the Performance of TempDB"></a></p><p>The Database Administrator must know something about the best configuration of TempDB.<br />
A general advice is, try to avoid the use of TempDB by creating temp tables.</p>
<p>But TempDB also stores other information related to query execution, internal sort operation, overflow memory data.</p>
<p>You should keep your eye open for TempDB otherwise it degrades the overall performance.</p>
<blockquote class="wp-embedded-content" data-secret="BVUgm0ikvW"><p><a href="https://www.dbrnd.com/2016/02/sql-server-the-tempdb-is-full-shrink-it-or-move-it/">SQL Server: The TempDB is Full, Shrink it or Move it</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/02/sql-server-the-tempdb-is-full-shrink-it-or-move-it/embed/#?secret=BVUgm0ikvW" data-secret="BVUgm0ikvW" width="600" height="338" title="&#8220;SQL Server: The TempDB is Full, Shrink it or Move it&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>Sharing few tips to improve the TempDB performance:</p>
<p><strong>Try to keep TempDB in local drive:</strong></p>
<blockquote><p>You should store TempDB in your local SSD drive instead of the shared network drive. This introduced by SQL Server 2012.</p></blockquote>
<blockquote><p>If you store other databases in shared network drive and TempDB in local drive, It creates a separate path for IO which divides the traffic and improves the performance.</p></blockquote>
<p><strong>Should configure multiple DATA Files:</strong></p>
<blockquote><p>You should create more data files equal to 1/2 or 1/4 the physical CPUs.</p></blockquote>
<blockquote><p>Once you have attached different data files to it, it stripped the files and performed the parallel operations.<br />
Now It has its own PFS, GAM, and SGAM pages, so it spreads the writing process which improves the writing performance.</p></blockquote>
<p><strong>Few other tips:</strong></p>
<ul>
<li>Set the recovery model of tempdb to SIMPLE.</li>
<li>Allow for tempdb files to automatically grow as required.</li>
<li>Set preallocate space for all tempdb files and it prevents tempdb from expanding too frequently.</li>
<li>Make each data file the same size.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/03/sql-server-optimize-the-performance-of-tempdb-add-multiple-data-files-store-ssd/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server 2012: SORT_IN_TEMPDB used to Improve the Index Rebuild Performance</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb/</link>
					<comments>https://www.dbrnd.com/2018/01/sql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 09 Jan 2018 16:16:07 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Index Rebuild]]></category>
		<category><![CDATA[query performance]]></category>
		<category><![CDATA[Sort Operation]]></category>
		<category><![CDATA[SORT_IN_TEMPDB]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4209</guid>

					<description><![CDATA[<div><img width="679" height="382" src="https://www.dbrnd.com/wp-content/uploads/2017/12/Database-Perforamance-679x382.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQL Database Performance" decoding="async" loading="lazy" srcset="https://www.dbrnd.com/wp-content/uploads/2017/12/Database-Perforamance-679x382.jpg 679w, https://www.dbrnd.com/wp-content/uploads/2017/12/Database-Perforamance.jpg 800w" sizes="auto, (max-width: 679px) 100vw, 679px" /></div>SQL Server 2012 enhanced the performance of INDEX REBUILD by introducing the SORT_IN_TEMPDB option. I observed that many SQL developers are not using this feature or maybe they don&#8217;t know about it. The INDEX REBUILD operation is removing the fragmentation of indexes which improves the query performance. It scans the data pages of base table [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="679" height="382" src="https://www.dbrnd.com/wp-content/uploads/2017/12/Database-Perforamance-679x382.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQL Database Performance" decoding="async" loading="lazy" srcset="https://www.dbrnd.com/wp-content/uploads/2017/12/Database-Perforamance-679x382.jpg 679w, https://www.dbrnd.com/wp-content/uploads/2017/12/Database-Perforamance.jpg 800w" sizes="auto, (max-width: 679px) 100vw, 679px" /></div><p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb%2F&amp;linkname=SQL%20Server%202012%3A%20SORT_IN_TEMPDB%20used%20to%20Improve%20the%20Index%20Rebuild%20Performance" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb%2F&amp;linkname=SQL%20Server%202012%3A%20SORT_IN_TEMPDB%20used%20to%20Improve%20the%20Index%20Rebuild%20Performance" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb%2F&amp;linkname=SQL%20Server%202012%3A%20SORT_IN_TEMPDB%20used%20to%20Improve%20the%20Index%20Rebuild%20Performance" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb%2F&amp;linkname=SQL%20Server%202012%3A%20SORT_IN_TEMPDB%20used%20to%20Improve%20the%20Index%20Rebuild%20Performance" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb%2F&amp;linkname=SQL%20Server%202012%3A%20SORT_IN_TEMPDB%20used%20to%20Improve%20the%20Index%20Rebuild%20Performance" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb%2F&amp;linkname=SQL%20Server%202012%3A%20SORT_IN_TEMPDB%20used%20to%20Improve%20the%20Index%20Rebuild%20Performance" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb%2F&#038;title=SQL%20Server%202012%3A%20SORT_IN_TEMPDB%20used%20to%20Improve%20the%20Index%20Rebuild%20Performance" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb/" data-a2a-title="SQL Server 2012: SORT_IN_TEMPDB used to Improve the Index Rebuild Performance"></a></p><p>SQL Server 2012 enhanced the performance of INDEX REBUILD by introducing the SORT_IN_TEMPDB option.<br />
I observed that many SQL developers are not using this feature or maybe they don&#8217;t know about it. </p>
<blockquote><p>The INDEX REBUILD operation is removing the fragmentation of indexes which improves the query performance. It scans the data pages of base table to retrieve the key values and builds an index leaf row for each row.
</p></blockquote>
<blockquote><p>This process requires internal sorting which it stores in the buffer area.</p></blockquote>
<blockquote><p>Once the buffer filled with leaf index entries, it stores the sorted result into a disk as an intermediate sort run. Next, It again starts with the same process for further data pages.</p></blockquote>
<p>As per the MSDN,</p>
<blockquote><p>When you create or rebuild an index, by setting the SORT_IN_TEMPDB option to ON you can direct the SQL Server Database Engine to use tempdb to store the intermediate sort results that are used to build the index. </p>
<p>Although this option increases the amount of temporary disk space that is used to create an index, the option could reduce the time that is required to create or rebuild an index when tempdb is on a set of disks different from that of the user database.</p>
<p>If SORT_IN_TEMPDB is set to ON, there must be sufficient free space in tempdb to store the collection of sort runs for the largest index.</p></blockquote>
<p>When you are rebuilding the large size of Indexes, SORT_IN_TEMPDB helps you lot by reducing the operational execution time. </p>
<p><strong>Sample Script with option SORT_IN_TEMPDB:</strong></p>
<pre class="crayon-plain-tag">ALTER INDEX ALL ON MyTableName
REBUILD WITH 
(FILLFACTOR = 80, SORT_IN_TEMPDB = ON,
 STATISTICS_NORECOMPUTE = ON);
GO</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/01/sql-server-2012-sort_in_tempdb-used-to-improve-the-index-rebuild-performance-sort-operation-to-tempdb/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server Interview: List out the Best Practices, after installation of SQL Server</title>
		<link>https://www.dbrnd.com/2017/09/sql-server-interview-list-out-the-best-practices-after-installation-of-sql-server/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 06 Sep 2017 16:16:02 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[MAXDOP]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TCP IP]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6036</guid>

					<description><![CDATA[In this post, I am sharing an important interview question which can be asked in SQL DBA interview. You should know at least five good points or practices that you are following after the fresh installation of SQL Server. Please check the below few best practices, and Below is not a complete list so you [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-interview-list-out-the-best-practices-after-installation-of-sql-server%2F&amp;linkname=SQL%20Server%20Interview%3A%20List%20out%20the%20Best%20Practices%2C%20after%20installation%20of%20SQL%20Server" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-interview-list-out-the-best-practices-after-installation-of-sql-server%2F&amp;linkname=SQL%20Server%20Interview%3A%20List%20out%20the%20Best%20Practices%2C%20after%20installation%20of%20SQL%20Server" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-interview-list-out-the-best-practices-after-installation-of-sql-server%2F&amp;linkname=SQL%20Server%20Interview%3A%20List%20out%20the%20Best%20Practices%2C%20after%20installation%20of%20SQL%20Server" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-interview-list-out-the-best-practices-after-installation-of-sql-server%2F&amp;linkname=SQL%20Server%20Interview%3A%20List%20out%20the%20Best%20Practices%2C%20after%20installation%20of%20SQL%20Server" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-interview-list-out-the-best-practices-after-installation-of-sql-server%2F&amp;linkname=SQL%20Server%20Interview%3A%20List%20out%20the%20Best%20Practices%2C%20after%20installation%20of%20SQL%20Server" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-interview-list-out-the-best-practices-after-installation-of-sql-server%2F&amp;linkname=SQL%20Server%20Interview%3A%20List%20out%20the%20Best%20Practices%2C%20after%20installation%20of%20SQL%20Server" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-interview-list-out-the-best-practices-after-installation-of-sql-server%2F&#038;title=SQL%20Server%20Interview%3A%20List%20out%20the%20Best%20Practices%2C%20after%20installation%20of%20SQL%20Server" data-a2a-url="https://www.dbrnd.com/2017/09/sql-server-interview-list-out-the-best-practices-after-installation-of-sql-server/" data-a2a-title="SQL Server Interview: List out the Best Practices, after installation of SQL Server"></a></p><p>In this post, I am sharing an important interview question which can be asked in SQL DBA interview. </p>
<p>You should know at least five good points or practices that you are following after the fresh installation of SQL Server.</p>
<p>Please check the below few best practices, and Below is not a complete list so you guys can share more good practices via comments. </p>
<p><strong>Disable Services which are not require</strong></p>
<blockquote><p>For example, If you installed a default SQL Instance and not going to install any other instance, disable the Brower Service.</p></blockquote>
<p><strong>Change the Service mode</strong></p>
<blockquote><p>It is recommended to change the start mode of the SQL Agent so on each server restart; the service will start automatically. </p></blockquote>
<p><strong>Set the Minimum and Maximum Server Memory </strong></p>
<p><strong>Set Auto growth Size for Database</strong></p>
<p><strong>Set database properties for following options</strong></p>
<blockquote><p>Right click on database -> go to properties -> Options<br />
Auto Close &#8211; False<br />
Auto Create Statistics &#8211; True<br />
Auto Shrink &#8211; False<br />
Auto Update Statistics &#8211; True<br />
Auto Update Statistics Asynchronously &#8211; True</p></blockquote>
<p><strong>Change the default storage location of TempDB and set in another disk </strong></p>
<p><strong>Change the default Index Fill Factor</strong></p>
<blockquote><p>Open SSMS -> Right click on SQL Server Instance -> Go to properties -> Database Settings -> Change Default Index Fill Factor<br />
Default Index Fill Factor is 0 or 100, means full. If your system is generating more OLTP transactions, you should set it between 80 to 90</p></blockquote>
<p><strong>Configure Processor for MAXDOP to achieve the parallel processing</strong></p>
<blockquote><p>Open SSMS -> Right click on SQL Server Instance -> Go to properties -> Advanced -> Change Max Degree of Parallelism</p></blockquote>
<p><strong>Change the SQL Database default locations</strong></p>
<blockquote><p>Open SSMS -> Right click on SQL Server Instance -> Go to properties -> Database Settings -> Change Database default locations</p></blockquote>
<p><strong>Change Remote Query Timeout</strong></p>
<blockquote><p>Open SSMS -> Right click on SQL Server Instance -> Go to properties -> Connections<br />
The default wait is 600, you can set to 5 or 8 minutes.</p></blockquote>
<p><strong>Configure SQL Server Network</strong></p>
<blockquote><p>Open SQL Server Configuration Manager and check for SQL Server Network Configuration<br />
Enable the TCP/IP protocol</p></blockquote>
<p><strong>Change the password of SA user</strong></p>
<blockquote><p>Remove the BUILTIN\Administrators group from the SQL Server Logins</p></blockquote>
<p><strong>Check the Server Authentication Mode and enable C2 Audit tracing</strong></p>
<blockquote><p>Open SSMS -> Right click on SQL Server Instance -> Go to properties -> Security<br />
C2 audit is used to trace all the user activities like SQL Commands, Login, Logout, and server events</p></blockquote>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: How to move TempDB from one drive to another drive</title>
		<link>https://www.dbrnd.com/2017/04/sql-server-how-to-move-tempdb-from-one-drive-to-another-drive/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 26 Apr 2017 16:16:39 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[TempDB optimization]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5071</guid>

					<description><![CDATA[In this post, I am sharing necessary steps to move SQL Server TempDB from one location to another location. When you are searching for TempDB optimization tips, you can find one tip like to change the location of TempDB because it should not be with SQL Server data file and the main reason is unpredictable [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-how-to-move-tempdb-from-one-drive-to-another-drive%2F&amp;linkname=SQL%20Server%3A%20How%20to%20move%20TempDB%20from%20one%20drive%20to%20another%20drive" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-how-to-move-tempdb-from-one-drive-to-another-drive%2F&amp;linkname=SQL%20Server%3A%20How%20to%20move%20TempDB%20from%20one%20drive%20to%20another%20drive" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-how-to-move-tempdb-from-one-drive-to-another-drive%2F&amp;linkname=SQL%20Server%3A%20How%20to%20move%20TempDB%20from%20one%20drive%20to%20another%20drive" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-how-to-move-tempdb-from-one-drive-to-another-drive%2F&amp;linkname=SQL%20Server%3A%20How%20to%20move%20TempDB%20from%20one%20drive%20to%20another%20drive" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-how-to-move-tempdb-from-one-drive-to-another-drive%2F&amp;linkname=SQL%20Server%3A%20How%20to%20move%20TempDB%20from%20one%20drive%20to%20another%20drive" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-how-to-move-tempdb-from-one-drive-to-another-drive%2F&amp;linkname=SQL%20Server%3A%20How%20to%20move%20TempDB%20from%20one%20drive%20to%20another%20drive" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-how-to-move-tempdb-from-one-drive-to-another-drive%2F&#038;title=SQL%20Server%3A%20How%20to%20move%20TempDB%20from%20one%20drive%20to%20another%20drive" data-a2a-url="https://www.dbrnd.com/2017/04/sql-server-how-to-move-tempdb-from-one-drive-to-another-drive/" data-a2a-title="SQL Server: How to move TempDB from one drive to another drive"></a></p><p>In this post, I am sharing necessary steps to move SQL Server TempDB from one location to another location.<br />
When you are searching for TempDB optimization tips, you can find one tip like to change the location of TempDB because it should not be with SQL Server data file and the main reason is unpredictable size and maintenance of it. </p>
<p>I would suggest following steps to move your TempDB from one drive to another drive:</p>
<p><strong>Identify the location of TempDB:</strong></p>
<pre class="crayon-plain-tag">SELECT 
	name
	,physical_name AS Location
FROM sys.master_files
WHERE database_id = DB_ID(N'tempdb')
GO</pre> </p>
<p><strong>Change the location of TempDB, using ALTER DATABASE:</strong></p>
<pre class="crayon-plain-tag">ALTER DATABASE tempdb 
MODIFY FILE (NAME = tempdev, FILENAME = 'D:\YourDrive\tempdb.mdf');
GO

ALTER DATABASE tempdb 
MODIFY FILE (NAME = templog, FILENAME = 'D:\YourDrive\templog.ldf');
GO</pre> </p>
<p><strong>Once you execute above ALTERs, you will get below messages:</strong></p>
<pre class="crayon-plain-tag">The file "tempdev" has been modified in the system catalog. The new path will be used the next time the database is started.
The file "templog" has been modified in the system catalog. The new path will be used the next time the database is started.</pre> </p>
<p><strong>Next, Restart the Service of SQL Server.</strong></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Create index on large Temp Tables</title>
		<link>https://www.dbrnd.com/2017/02/sql-server-create-index-on-large-temp-tables-clustered-non-clustered-index/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 26 Feb 2017 16:16:02 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[Temp db Performance]]></category>
		<category><![CDATA[Temp Table]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4198</guid>

					<description><![CDATA[I have given one assignment to a database developer team for preparing general database development practices. I have found one point in that document: &#8220;Do not create Indexes on Temp Tables&#8221;. The use of Temp Tables is very common in SQL Server. Most of the SQL database developers are storing their data into temp tables. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-create-index-on-large-temp-tables-clustered-non-clustered-index%2F&amp;linkname=SQL%20Server%3A%20Create%20index%20on%20large%20Temp%20Tables" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-create-index-on-large-temp-tables-clustered-non-clustered-index%2F&amp;linkname=SQL%20Server%3A%20Create%20index%20on%20large%20Temp%20Tables" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-create-index-on-large-temp-tables-clustered-non-clustered-index%2F&amp;linkname=SQL%20Server%3A%20Create%20index%20on%20large%20Temp%20Tables" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-create-index-on-large-temp-tables-clustered-non-clustered-index%2F&amp;linkname=SQL%20Server%3A%20Create%20index%20on%20large%20Temp%20Tables" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-create-index-on-large-temp-tables-clustered-non-clustered-index%2F&amp;linkname=SQL%20Server%3A%20Create%20index%20on%20large%20Temp%20Tables" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-create-index-on-large-temp-tables-clustered-non-clustered-index%2F&amp;linkname=SQL%20Server%3A%20Create%20index%20on%20large%20Temp%20Tables" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-create-index-on-large-temp-tables-clustered-non-clustered-index%2F&#038;title=SQL%20Server%3A%20Create%20index%20on%20large%20Temp%20Tables" data-a2a-url="https://www.dbrnd.com/2017/02/sql-server-create-index-on-large-temp-tables-clustered-non-clustered-index/" data-a2a-title="SQL Server: Create index on large Temp Tables"></a></p><p><em>I have given one assignment to a database developer team for preparing general database development practices.<br />
I have found one point in that document: &#8220;Do not create Indexes on Temp Tables&#8221;.</em></p>
<p>The use of Temp Tables is very common in SQL Server. Most of the SQL database developers are storing their data into temp tables.<br />
Let me, explore something about, the best practices of Temp Tables. </p>
<blockquote><p>In general advice, we should avoid the use of temp tables because it requires more CPU/IO while accessing the TempDB.<br />
When you are storing data into temp tables, it stores in TempDB files means the physical disk operation is involved.</p></blockquote>
<blockquote><p>Like any other regular table, temp table also requires disk space to store temporary data and other resources for manipulation.</p></blockquote>
<blockquote><p>I have seen that many developers are saving a significant number of records in Temp Tables and they are not thinking even for Indexing on Temp Tables.</p></blockquote>
<blockquote><p>If you don&#8217;t know, please note: You can create a Clustered and Non-Clustered Indexes on Temp Tables which improves your query performance.</p></blockquote>
<blockquote><p>Again, more indexes will create more problems because it needs space and manipulation.<br />
First, you should analyze the volume of data, execution plan and accordingly you should apply indexes on Temp tables.</p></blockquote>
<blockquote><p>Personally, I have checked the performance of Temp Tables with Clustered Index, which is much better than Temp Table without an Indexes. </p></blockquote>
<p><em>I am rejecting all comments and points which say that &#8221; we should not apply Indexes on Temp Tables. &#8220;</em></p>
<blockquote class="wp-embedded-content" data-secret="BbyB9dqjyi"><p><a href="https://www.dbrnd.com/2016/02/sql-server-difference-between-temporary-table-and-table-variable/">SQL Server: Difference between Temporary Table and Table Variable</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/02/sql-server-difference-between-temporary-table-and-table-variable/embed/#?secret=BbyB9dqjyi" data-secret="BbyB9dqjyi" width="600" height="338" title="&#8220;SQL Server: Difference between Temporary Table and Table Variable&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: Configure a TempDB for Autogrowth and Multiple data files</title>
		<link>https://www.dbrnd.com/2017/02/sql-server-2016-configure-a-tempdb-for-autogrowth-and-multiple-data-files-initial-size/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 14 Feb 2017 16:16:25 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[autogrowth]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Multiple data files]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4531</guid>

					<description><![CDATA[SQL Server 2016 introduced additional configuration tab of TempDB while running the installation of SQL Server. When you are hunting like &#8220;How to improve the performance of TemoDB&#8221;, you can find one standard solution like split your TempDB into multiple data files. Now with the SQL Server 2016 CTP3, you can set multiple data files [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-configure-a-tempdb-for-autogrowth-and-multiple-data-files-initial-size%2F&amp;linkname=SQL%20Server%202016%3A%20Configure%20a%20TempDB%20for%20Autogrowth%20and%20Multiple%20data%20files" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-configure-a-tempdb-for-autogrowth-and-multiple-data-files-initial-size%2F&amp;linkname=SQL%20Server%202016%3A%20Configure%20a%20TempDB%20for%20Autogrowth%20and%20Multiple%20data%20files" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-configure-a-tempdb-for-autogrowth-and-multiple-data-files-initial-size%2F&amp;linkname=SQL%20Server%202016%3A%20Configure%20a%20TempDB%20for%20Autogrowth%20and%20Multiple%20data%20files" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-configure-a-tempdb-for-autogrowth-and-multiple-data-files-initial-size%2F&amp;linkname=SQL%20Server%202016%3A%20Configure%20a%20TempDB%20for%20Autogrowth%20and%20Multiple%20data%20files" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-configure-a-tempdb-for-autogrowth-and-multiple-data-files-initial-size%2F&amp;linkname=SQL%20Server%202016%3A%20Configure%20a%20TempDB%20for%20Autogrowth%20and%20Multiple%20data%20files" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-configure-a-tempdb-for-autogrowth-and-multiple-data-files-initial-size%2F&amp;linkname=SQL%20Server%202016%3A%20Configure%20a%20TempDB%20for%20Autogrowth%20and%20Multiple%20data%20files" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-configure-a-tempdb-for-autogrowth-and-multiple-data-files-initial-size%2F&#038;title=SQL%20Server%202016%3A%20Configure%20a%20TempDB%20for%20Autogrowth%20and%20Multiple%20data%20files" data-a2a-url="https://www.dbrnd.com/2017/02/sql-server-2016-configure-a-tempdb-for-autogrowth-and-multiple-data-files-initial-size/" data-a2a-title="SQL Server 2016: Configure a TempDB for Autogrowth and Multiple data files"></a></p><p>SQL Server 2016 introduced additional configuration tab of TempDB while running the installation of SQL Server.</p>
<p>When you are hunting like &#8220;How to improve the performance of TemoDB&#8221;, you can find one standard solution like split your TempDB into multiple data files.</p>
<blockquote><p>Now with the SQL Server 2016 CTP3, you can set multiple data files while installing SQL Server.<br />
Next question should be, how many total numbers of data files we can set for TempDB?</p></blockquote>
<blockquote><p>It defined the rule of this like If you have 2 Core CPU, you can set 2 Data Files, 4 CPU CORE = 4 Data files, 8 CPU CORE = 8 Data Files. You can create maximum 8 Data files so for 16 CPU CORE = 8 Data Files only.</p></blockquote>
<p>You can check the below sample screen shot.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4541 size-full" title="SQL Server TempDb Configuration" src="https://www.dbrnd.com/wp-content/uploads/2017/02/SQLServerTempDbConfiguration.png" alt="SQLServer TempDb Configuration" width="600" height="449" srcset="https://www.dbrnd.com/wp-content/uploads/2017/02/SQLServerTempDbConfiguration.png 600w, https://www.dbrnd.com/wp-content/uploads/2017/02/SQLServerTempDbConfiguration-300x225.png 300w, https://www.dbrnd.com/wp-content/uploads/2017/02/SQLServerTempDbConfiguration-150x112.png 150w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: TempDB enhancement &#8211; by default turn on trace flags 1117 and 1118</title>
		<link>https://www.dbrnd.com/2017/02/sql-server-2016-tempdb-enhancement-by-default-turn-on-trace-flags-1117-and-1118-auto-growth-extent-allocation/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 12 Feb 2017 16:16:06 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[auto growth]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[extent allocation]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[trace flag 1117]]></category>
		<category><![CDATA[trace flag 1118]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4520</guid>

					<description><![CDATA[I am exploring SQL Server 2016 and every time I am getting something new and effective enhancements those added in SQL Server 2016. Whenever you are searching for TempDB optimization tips, you can find one note for trace flags 1117 and 1118 which are for Allocations and Auto Growth. You can use trace flag 1117 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-tempdb-enhancement-by-default-turn-on-trace-flags-1117-and-1118-auto-growth-extent-allocation%2F&amp;linkname=SQL%20Server%202016%3A%20TempDB%20enhancement%20%E2%80%93%20by%20default%20turn%20on%20trace%20flags%201117%20and%201118" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-tempdb-enhancement-by-default-turn-on-trace-flags-1117-and-1118-auto-growth-extent-allocation%2F&amp;linkname=SQL%20Server%202016%3A%20TempDB%20enhancement%20%E2%80%93%20by%20default%20turn%20on%20trace%20flags%201117%20and%201118" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-tempdb-enhancement-by-default-turn-on-trace-flags-1117-and-1118-auto-growth-extent-allocation%2F&amp;linkname=SQL%20Server%202016%3A%20TempDB%20enhancement%20%E2%80%93%20by%20default%20turn%20on%20trace%20flags%201117%20and%201118" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-tempdb-enhancement-by-default-turn-on-trace-flags-1117-and-1118-auto-growth-extent-allocation%2F&amp;linkname=SQL%20Server%202016%3A%20TempDB%20enhancement%20%E2%80%93%20by%20default%20turn%20on%20trace%20flags%201117%20and%201118" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-tempdb-enhancement-by-default-turn-on-trace-flags-1117-and-1118-auto-growth-extent-allocation%2F&amp;linkname=SQL%20Server%202016%3A%20TempDB%20enhancement%20%E2%80%93%20by%20default%20turn%20on%20trace%20flags%201117%20and%201118" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-tempdb-enhancement-by-default-turn-on-trace-flags-1117-and-1118-auto-growth-extent-allocation%2F&amp;linkname=SQL%20Server%202016%3A%20TempDB%20enhancement%20%E2%80%93%20by%20default%20turn%20on%20trace%20flags%201117%20and%201118" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F02%2Fsql-server-2016-tempdb-enhancement-by-default-turn-on-trace-flags-1117-and-1118-auto-growth-extent-allocation%2F&#038;title=SQL%20Server%202016%3A%20TempDB%20enhancement%20%E2%80%93%20by%20default%20turn%20on%20trace%20flags%201117%20and%201118" data-a2a-url="https://www.dbrnd.com/2017/02/sql-server-2016-tempdb-enhancement-by-default-turn-on-trace-flags-1117-and-1118-auto-growth-extent-allocation/" data-a2a-title="SQL Server 2016: TempDB enhancement – by default turn on trace flags 1117 and 1118"></a></p><p>I am exploring SQL Server 2016 and every time I am getting something new and effective enhancements those added in SQL Server 2016.</p>
<blockquote><p>Whenever you are searching for TempDB optimization tips, you can find one note for trace flags 1117 and 1118 which are for Allocations and Auto Growth.</p></blockquote>
<p><strong>You can use trace flag 1117 &#8211; </strong> When growing a data file grow all files at the same time, so they remain the same size, reducing allocation contention points.<br />
<strong>You can use trace flag 1118 &#8211; </strong> When doing allocations for user tables always allocate full extents. It reduces contention of mixed extent allocations.</p>
<p>Eariler, you can turn on these trace flags at server level which impacts to other databases as well.<br />
And now the great enhancement by SQL Server 2016 is, it enables these flags by default for TempDB and customize for other user databases. </p>
<p>In the next post, You can find about How to enable trace flag 1117 and 1118 on user databases.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server:Warning in Query Execution Plan, &#8220;Operator used tempdb to spill data during execution with spill level 2&#8221;</title>
		<link>https://www.dbrnd.com/2016/11/sql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats/</link>
					<comments>https://www.dbrnd.com/2016/11/sql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 18 Nov 2016 18:07:18 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[AUTO_CREATE_STATISTICS]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Execution Plan]]></category>
		<category><![CDATA[Query Optimizer]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[TempDB Spill error]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3869</guid>

					<description><![CDATA[Before a few days ago, When I was performing query optimization at that time I have seen one warning in the result of SQL Server Query Execution Plan like: &#8220;Operator used tempdb to spill data during execution with spill level 2&#8221;. I performed RND on this and came to know very interesting reason this warning. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats%2F&amp;linkname=SQL%20Server%3AWarning%20in%20Query%20Execution%20Plan%2C%20%E2%80%9COperator%20used%20tempdb%20to%20spill%20data%20during%20execution%20with%20spill%20level%202%E2%80%9D" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats%2F&amp;linkname=SQL%20Server%3AWarning%20in%20Query%20Execution%20Plan%2C%20%E2%80%9COperator%20used%20tempdb%20to%20spill%20data%20during%20execution%20with%20spill%20level%202%E2%80%9D" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats%2F&amp;linkname=SQL%20Server%3AWarning%20in%20Query%20Execution%20Plan%2C%20%E2%80%9COperator%20used%20tempdb%20to%20spill%20data%20during%20execution%20with%20spill%20level%202%E2%80%9D" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats%2F&amp;linkname=SQL%20Server%3AWarning%20in%20Query%20Execution%20Plan%2C%20%E2%80%9COperator%20used%20tempdb%20to%20spill%20data%20during%20execution%20with%20spill%20level%202%E2%80%9D" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats%2F&amp;linkname=SQL%20Server%3AWarning%20in%20Query%20Execution%20Plan%2C%20%E2%80%9COperator%20used%20tempdb%20to%20spill%20data%20during%20execution%20with%20spill%20level%202%E2%80%9D" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats%2F&amp;linkname=SQL%20Server%3AWarning%20in%20Query%20Execution%20Plan%2C%20%E2%80%9COperator%20used%20tempdb%20to%20spill%20data%20during%20execution%20with%20spill%20level%202%E2%80%9D" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats%2F&#038;title=SQL%20Server%3AWarning%20in%20Query%20Execution%20Plan%2C%20%E2%80%9COperator%20used%20tempdb%20to%20spill%20data%20during%20execution%20with%20spill%20level%202%E2%80%9D" data-a2a-url="https://www.dbrnd.com/2016/11/sql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats/" data-a2a-title="SQL Server:Warning in Query Execution Plan, “Operator used tempdb to spill data during execution with spill level 2”"></a></p><p>Before a few days ago, When I was performing query optimization at that time I have seen one warning in the result of SQL Server Query Execution Plan like:<strong> &#8220;Operator used tempdb to spill data during execution with spill level 2&#8221;.</strong><br />
I performed RND on this and came to know very interesting reason this warning. </p>
<blockquote><p>If you don&#8217;t know, please note that Database Statistics are playing main to prepare and generate the Query Execution Plan. </p></blockquote>
<blockquote><p>SQL Server Statistics contain different types of meta data information like total number records, indexes, access path and others. </p></blockquote>
<blockquote><p>This warning occurred because my database Statistics are not updated.<br />
For example, my table has total 50000 records and Statistics contains only 5000 records information so the planner prepares the query execution plan according to 5000 records only. </p></blockquote>
<blockquote><p>While executing the query, If it finds more than 5000 records, It transfers other additional records first into TempDB and continue further process using TempDB. Because It calculated processing capacity only for 5000 records. </p></blockquote>
<blockquote><p>This process degrades the overall query performance and that&#8217;s why you can see a warning like: &#8220;Operator used tempdb to spill data during execution with spill level 2&#8221;.</p></blockquote>
<p><strong>The solution is:</strong></p>
<blockquote><p>Find Statistics data for tables and indexes and If Statistics data are not updated, update your Statistics data, so that Query Optimizer can prepare the best Query Execution Plan.
</p></blockquote>
<p><strong>Check the Statistics for particular index: </strong><br />
If you find difference between Rows and Rows Sampled, Statistics is not updated. </p>
<pre class="crayon-plain-tag">DBCC SHOW_STATISTICS ("TableName", IndexName);</pre> </p>
<p><strong>Update all Statistics for Database: </strong></p>
<pre class="crayon-plain-tag">EXEC sp_updatestats;</pre> </p>
<p><strong>Update Statistics for Table:</strong></p>
<pre class="crayon-plain-tag">UPDATE STATISTICS TABLE_NAME;</pre> </p>
<p><strong>Update Statistics for Index:</strong></p>
<pre class="crayon-plain-tag">UPDATE STATISTICS TABLE_NAME INDEX_NAME;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/11/sql-serverwarning-in-query-execution-plan-operator-used-tempdb-to-spill-data-during-execution-with-spill-level-2-sql-update-statistics-sp_updatestats/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: The TempDB is Full, Shrink it or Move it</title>
		<link>https://www.dbrnd.com/2016/02/sql-server-the-tempdb-is-full-shrink-it-or-move-it/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 05 Feb 2016 21:05:03 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Shrink]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1487</guid>

					<description><![CDATA[In this post, I am sharing a script to Shrink TempDB when it is full or occupying more hard disk space. We know that TempDB contains temporary tables and other objects which are created by the user or system. It also holds intermediate results that produced during query processing. The TempDB also stores the different [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F02%2Fsql-server-the-tempdb-is-full-shrink-it-or-move-it%2F&amp;linkname=SQL%20Server%3A%20The%20TempDB%20is%20Full%2C%20Shrink%20it%20or%20Move%20it" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F02%2Fsql-server-the-tempdb-is-full-shrink-it-or-move-it%2F&amp;linkname=SQL%20Server%3A%20The%20TempDB%20is%20Full%2C%20Shrink%20it%20or%20Move%20it" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F02%2Fsql-server-the-tempdb-is-full-shrink-it-or-move-it%2F&amp;linkname=SQL%20Server%3A%20The%20TempDB%20is%20Full%2C%20Shrink%20it%20or%20Move%20it" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F02%2Fsql-server-the-tempdb-is-full-shrink-it-or-move-it%2F&amp;linkname=SQL%20Server%3A%20The%20TempDB%20is%20Full%2C%20Shrink%20it%20or%20Move%20it" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F02%2Fsql-server-the-tempdb-is-full-shrink-it-or-move-it%2F&amp;linkname=SQL%20Server%3A%20The%20TempDB%20is%20Full%2C%20Shrink%20it%20or%20Move%20it" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F02%2Fsql-server-the-tempdb-is-full-shrink-it-or-move-it%2F&amp;linkname=SQL%20Server%3A%20The%20TempDB%20is%20Full%2C%20Shrink%20it%20or%20Move%20it" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F02%2Fsql-server-the-tempdb-is-full-shrink-it-or-move-it%2F&#038;title=SQL%20Server%3A%20The%20TempDB%20is%20Full%2C%20Shrink%20it%20or%20Move%20it" data-a2a-url="https://www.dbrnd.com/2016/02/sql-server-the-tempdb-is-full-shrink-it-or-move-it/" data-a2a-title="SQL Server: The TempDB is Full, Shrink it or Move it"></a></p><p>In this post, I am sharing a script to Shrink TempDB when it is full or occupying more hard disk space. </p>
<blockquote><p>We know that TempDB contains temporary tables and other objects which are created by the user or system.<br />
It also holds intermediate results that produced during query processing.<br />
The TempDB also stores the different version of data which are generated using Snapshot Isolation Levels. </p></blockquote>
<p>Because of above all reasons TempDB size is increasing so sometimes, we need to perform Shrink or we can move TempDB files from one location to another location. </p>
<p><strong>Using below script you can find the correct size of TempDB. </strong> </p>
<pre class="crayon-plain-tag">USE TempDB
GO

SELECT 
	Name
	,Physical_Name
	,Type_Desc
	,(Size*8) AS SizeInKB
FROM
SYS.DATABASE_FILES
GO</pre> </p>
<p>If we want to reset TempDB at some configured size, we should use to Shrink the TempDB.<br />
We can also use both ALTER DATABASE and SHRINK command to reduce the size of the TempDB. </p>
<p><strong>Using ALTER DATABASE:</strong></p>
<pre class="crayon-plain-tag">ALTER DATABASE tempdb MODIFY FILE
(NAME = 'tempdev', SIZE = target_size_in_MB) 
   --Desired target size for the data file

ALTER DATABASE tempdb MODIFY FILE
(NAME = 'templog', SIZE = target_size_in_MB)
   --Desired target size for the log file</pre> </p>
<p><strong>Using SHRINK:</strong></p>
<pre class="crayon-plain-tag">dbcc shrinkdatabase (tempdb, 'target percent') 
   -- This command shrinks the tempdb database</pre> </p>
<p><strong>Move TempDB from one location to another location:</strong></p>
<p>If we are facing size problem for a particular drive, we can also move the TempDB from one drive to another drive. </p>
<p>Before moving a TempDB, we should make sure that is set to autogrow and check the original size of TempDB files because we also require enough more space in the new location. </p>
<p><strong>Note: We need to restart the SQL Server Restart Process, after these changes. </strong></p>
<pre class="crayon-plain-tag">USE MASTER
GO
---- change the location of tempdev file
ALTER DATABASE TempDB MODIFY FILE
(NAME = tempdev, FILENAME = 'f:tempdb.mdf')
GO
---- change the location of templog file
ALTER DATABASE TempDB MODIFY FILE
(NAME = templog, FILENAME = 'f:templog.ldf')
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
