<?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>SQLWorkshops.com Blog</title>
	<atom:link href="http://blog.sqlworkshops.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlworkshops.com</link>
	<description>Microsoft SQL Server Performance Monitoring &#38; Tuning</description>
	<lastBuildDate>Mon, 16 May 2016 15:05:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Tempdb Metadata Contention in SQL Server &#8211; Table Variable Vs Temporary Table</title>
		<link>http://blog.sqlworkshops.com/tempdb-metadata-contention-in-sql-server-table-variable-vs-temporary-table/</link>
		<comments>http://blog.sqlworkshops.com/tempdb-metadata-contention-in-sql-server-table-variable-vs-temporary-table/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:40:07 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=246</guid>
		<description><![CDATA[In SQL Server, the concurrent creation of temporary tables from many sessions can lead to tempdb metadata contention. Tempdb metadata contention does not affect the concurrent creation of table variables. When SQL Server creates temporary tables, it has to update &#8230; <a href="http://blog.sqlworkshops.com/tempdb-metadata-contention-in-sql-server-table-variable-vs-temporary-table/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In SQL Server, the concurrent creation of temporary tables from many sessions can lead to tempdb metadata contention. Tempdb metadata contention does not affect the concurrent creation of table variables.</p>
<p>When SQL Server creates temporary tables, it has to update metadata information in the system based tables, like sys.sysschobjs (like PAGELATCH_EX and PAGELATCH_SH waits). This overhead is not there for table variables. Tempdb metadata management overhead leads to faster table variable declaration than temporary table creation, which is demonstrated in the below video. The tempdb metadata management overhead associated with temporary table is due to the temporary table having different scope than table variable where it is limited to the batch of stored procedure. Concurrent creation of temporary tables from many sessions will lead to concurrent update of metadata information in the system based tables, which leads to tempdb metadata contention.</p>
<p>Below video with hands-on example demonstrates the tempdb metadata contention. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/yIyZiNYoH-s" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out <a href="http://www.sqlvideo.com">http://www.sqlvideo.com</a> for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/tempdb-metadata-contention-in-sql-server-table-variable-vs-temporary-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AlwaysOn Availability Groups Synchronous Replica Readable Secondary Data Access Latency</title>
		<link>http://blog.sqlworkshops.com/alwayson-availability-groups-synchronous-replica-readable-secondary-data-access-latency/</link>
		<comments>http://blog.sqlworkshops.com/alwayson-availability-groups-synchronous-replica-readable-secondary-data-access-latency/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:39:36 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=266</guid>
		<description><![CDATA[With SQL Server AlwaysOn Availability Groups, when you configure a secondary in synchronous-commit mode for read-only access, there can be data access latency. If you make changes to your data like if you perform insert, update or delete in primary, &#8230; <a href="http://blog.sqlworkshops.com/alwayson-availability-groups-synchronous-replica-readable-secondary-data-access-latency/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>With SQL Server AlwaysOn Availability Groups, when you configure a secondary in synchronous-commit mode for read-only access, there can be data access latency.</p>
<p>If you make changes to your data like if you perform insert, update or delete in primary, those changes may not be visible in the secondary, synchronous replica enabled for read-only access for a certain amount of time, because writing to Log is synchronous, but not REDO. REDO is asynchronous, that is, applying those changes from Log is asynchronous.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/JXgcOWopk5E" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/alwayson-availability-groups-synchronous-replica-readable-secondary-data-access-latency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Seek or Scan &#8211; Cost Based Optimizer in SQL Server</title>
		<link>http://blog.sqlworkshops.com/seek-or-scan-cost-based-optimizer-in-sql-server/</link>
		<comments>http://blog.sqlworkshops.com/seek-or-scan-cost-based-optimizer-in-sql-server/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:39:06 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=264</guid>
		<description><![CDATA[When SQL Server has a choice of plans, it will compare the cost among a set of execution plans and will choose the cheapest one. In some cases, even though the cost of seek is slightly higher than the cost &#8230; <a href="http://blog.sqlworkshops.com/seek-or-scan-cost-based-optimizer-in-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>When SQL Server has a choice of plans, it will compare the cost among a set of execution plans and will choose the cheapest one.</p>
<p>In some cases, even though the cost of seek is slightly higher than the cost of scan, SQL Server Optimize might still choose a seek based plan as demonstrated in the video.</p>
<p>SQL Server may not evaluate all possible plans, there are various stages of optimization and SQL Server will evaluate a subset of plans at these stages.<br />
The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/PTHzmG1a6Bg" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/seek-or-scan-cost-based-optimizer-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimize for Ad Hoc Workloads &#8211; SQL Server Configuration Parameter</title>
		<link>http://blog.sqlworkshops.com/optimize-for-ad-hoc-workloads-sql-server-configuration-parameter/</link>
		<comments>http://blog.sqlworkshops.com/optimize-for-ad-hoc-workloads-sql-server-configuration-parameter/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:38:39 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=262</guid>
		<description><![CDATA[SQL Server configuration parameter “optimized for ad hoc workloads” can be very useful when you execute lots of single use ad hoc statements or dynamic SQL statements by reducing memory usage of plan cache. If the majority of ad hoc &#8230; <a href="http://blog.sqlworkshops.com/optimize-for-ad-hoc-workloads-sql-server-configuration-parameter/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>SQL Server configuration parameter “optimized for ad hoc workloads” can be very useful when you execute lots of single use ad hoc statements or dynamic SQL statements by reducing memory usage of plan cache. If the majority of ad hoc statements or dynamic SQL statements execute more than once, then “optimize for ad hoc workloads” configuration parameter can increase the CPU usage due to additional optimization cost and hence it is not recommended in such scenarios</p>
<p>When the plan is stable, that is, when the query hash and query plan hash is the same for all executions, it is recommended that you parameterize these statements to reduce plan cache pollution.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/s4UOMzNGIzQ" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/optimize-for-ad-hoc-workloads-sql-server-configuration-parameter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extended Event Locks Lock Waits in SQL Server</title>
		<link>http://blog.sqlworkshops.com/extended-event-locks-lock-waits-in-sql-server/</link>
		<comments>http://blog.sqlworkshops.com/extended-event-locks-lock-waits-in-sql-server/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:38:18 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=260</guid>
		<description><![CDATA[When it comes to lock waits, one of the important information we need to know is which statement waited for locks and how long. This is possible with extended events; it is not possible with SQL Server profiler. locks_lock_waits event &#8230; <a href="http://blog.sqlworkshops.com/extended-event-locks-lock-waits-in-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>When it comes to lock waits, one of the important information we need to know is which statement waited for locks and how long. This is possible with extended events; it is not possible with SQL Server profiler.</p>
<p>locks_lock_waits event is very useful to find statements that waited for locks more than a certain amount of time.</p>
<p>When you are using extended events, always use the counters predicate to limit the amount of events you are collecting.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/j-UyTQo11rQ" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/extended-event-locks-lock-waits-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extended Event Query Post Execution Showplan in SQL Server</title>
		<link>http://blog.sqlworkshops.com/extended-event-query-post-execution-showplan-in-sql-server/</link>
		<comments>http://blog.sqlworkshops.com/extended-event-query-post-execution-showplan-in-sql-server/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:37:57 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=258</guid>
		<description><![CDATA[Query Post Execution Showplan event is a very useful event to find problematic queries and execution plans based on CPU usage or duration while analyzing performance issues. It can increase the execution time of all queries by a fraction of &#8230; <a href="http://blog.sqlworkshops.com/extended-event-query-post-execution-showplan-in-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Query Post Execution Showplan event is a very useful event to find problematic queries and execution plans based on CPU usage or duration while analyzing performance issues.</p>
<p>It can increase the execution time of all queries by a fraction of a millisecond, irrespective of the total query cost, which means, the overhead of query_post_execution_showplan event is high for cheaper queries compared to expensive queries.</p>
<p>In all cases, one should enable the event on an ad hoc basis and with restrictive predicate to limit the number of events.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/6cDRwAvmfcc" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/extended-event-query-post-execution-showplan-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PAGELATCH Waits with Update Statements in SQL Server &#8211; PAGELATCH_EX and PAGELATCH_SH</title>
		<link>http://blog.sqlworkshops.com/pagelatch-waits-with-update-statements-in-sql-server-pagelatch_ex-and-pagelatch_sh/</link>
		<comments>http://blog.sqlworkshops.com/pagelatch-waits-with-update-statements-in-sql-server-pagelatch_ex-and-pagelatch_sh/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:37:25 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=255</guid>
		<description><![CDATA[In SQL Server, concurrent writes or read / write to the same page can lead to PAGELATCH (like PAGELATCH_EX and PAGELATCH_SH) waits or what is knowns as PAGELATCH contention. One common use case is when invoice numbers are stored in &#8230; <a href="http://blog.sqlworkshops.com/pagelatch-waits-with-update-statements-in-sql-server-pagelatch_ex-and-pagelatch_sh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In SQL Server, concurrent writes or read / write to the same page can lead to PAGELATCH (like PAGELATCH_EX and PAGELATCH_SH) waits or what is knowns as PAGELATCH contention.</p>
<p>One common use case is when invoice numbers are stored in a table. If the row is narrow, then many rows can fit in the 8KB page. This can lead to many invoicing number sequences being stored on the same page. When different invoicing number sequences are accessed from concurrent sessions, this can lead to PAGELATCH waits.</p>
<p>The way to solve this is to widen the rows so each row takes about a page and we don’t have contention on the same page.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/cqZA_l0fOTc" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/pagelatch-waits-with-update-statements-in-sql-server-pagelatch_ex-and-pagelatch_sh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tempdb Allocation Contention in SQL Server</title>
		<link>http://blog.sqlworkshops.com/tempdb-allocation-contention-in-sql-server/</link>
		<comments>http://blog.sqlworkshops.com/tempdb-allocation-contention-in-sql-server/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:36:53 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=248</guid>
		<description><![CDATA[In SQL Server, the concurrent creation of temporary objects (temporary tables and table variables) from many sessions can lead to tempdb allocation contention. This contention occurs on PFS and SGAM pages in tempdb (like PAGELATCH_EX and PAGELATCH_SH waits). It is &#8230; <a href="http://blog.sqlworkshops.com/tempdb-allocation-contention-in-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In SQL Server, the concurrent creation of temporary objects (temporary tables and table variables) from many sessions can lead to tempdb allocation contention. This contention occurs on PFS and SGAM pages in tempdb (like PAGELATCH_EX and PAGELATCH_SH waits). It is recommended to create additional data files for tempdb and implement trace flag 1118 to reduce this type of contention. Creating temporary objects, in a stored procedure will lead to temp table caching, this can also help reduce tempdb allocation contention.</p>
<p>After addressing Tempdb Allocation Contention, you will most probably encounter <a href="http://www.sqlvideo.com/AllVideos/Tempdb-Metadata-Contention---Table-Variable-Vs-Temporary-Table">Tempdb Metadata Contention</a> when you are using temporary tables (not when you are using table variables due to <a href="http://www.sqlvideo.com/AllVideos/Temp-Table-Caching-in-SQL-Server">Temp Table Caching</a>).</p>
<p>Below video with hands-on example demonstrates the tempdb allocation contention and explains the steps to reduce contention. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/Weao_qawXaE" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/tempdb-allocation-contention-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In-Memory OLTP Memory Optimized Table Variables Vs Disk Based Table Variable in SQL Server</title>
		<link>http://blog.sqlworkshops.com/in-memory-oltp-memory-optimized-table-variables-vs-disk-based-table-variable-in-sql-server/</link>
		<comments>http://blog.sqlworkshops.com/in-memory-oltp-memory-optimized-table-variables-vs-disk-based-table-variable-in-sql-server/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:36:09 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=243</guid>
		<description><![CDATA[Starting SQL Server 2014, it is possible to use memory optimized table variables. These are table variables declared using a table type which is memory optimized. Memory optimized table variables have no disk footprint and don’t have PAGELATCH (like PAGELATCH_EX &#8230; <a href="http://blog.sqlworkshops.com/in-memory-oltp-memory-optimized-table-variables-vs-disk-based-table-variable-in-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Starting SQL Server 2014, it is possible to use memory optimized table variables. These are table variables declared using a table type which is memory optimized. Memory optimized table variables have no disk footprint and don’t have PAGELATCH (like PAGELATCH_EX and PAGELATCH_SH) or LOGBUFFER waits, hence they result in faster performance compared to traditional disk based table variables.</p>
<p>Memory optimized table variables can be used in place of disk based table variables when possible.</p>
<p>Below video compares the performance difference between memory optimized table variables and traditional disk based table variables. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/-DVVcxvhyhM" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/in-memory-oltp-memory-optimized-table-variables-vs-disk-based-table-variable-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Temp Table Caching in SQL Server</title>
		<link>http://blog.sqlworkshops.com/temp-table-caching-in-sql-server/</link>
		<comments>http://blog.sqlworkshops.com/temp-table-caching-in-sql-server/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:35:44 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=236</guid>
		<description><![CDATA[SQL Server caches temporary objects (temporary tables and table variables), that are created in a stored procedure. Temporary objects that are created either in dynamic SQL statement or by using sp_executesql are not cached. Temp table caching can lead to &#8230; <a href="http://blog.sqlworkshops.com/temp-table-caching-in-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>SQL Server caches temporary objects (temporary tables and table variables), that are created in a stored procedure. Temporary objects that are created either in dynamic SQL statement or by using sp_executesql are not cached. Temp table caching can lead to better performance by reducing <a href="http://www.sqlvideo.com/AllVideos/Tempdb-Allocation-Contention-in-SQL-Server">Tempdb Allocation Contention</a>. SQL Server will not cache temporary table in certain cases, for example, if a DDL operation is performed on the temporary table (dropping temporary table is not a problem), or if a named constraint is created on the temporary table.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/fEpziVwRxqI" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/temp-table-caching-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filtered Statistics in SQL Server</title>
		<link>http://blog.sqlworkshops.com/filtered-statistics-in-sql-server/</link>
		<comments>http://blog.sqlworkshops.com/filtered-statistics-in-sql-server/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:35:21 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=234</guid>
		<description><![CDATA[In SQL Server, Filtered Statistics can improve cardinality estimation, i.e. when joining lookup table, or while joining fact table and dimension table. For this reason, SQL Server supports the creation of up to 30,000 statistics on non-indexed columns. Better estimation &#8230; <a href="http://blog.sqlworkshops.com/filtered-statistics-in-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In SQL Server, Filtered Statistics can improve cardinality estimation, i.e. when joining lookup table, or while joining fact table and dimension table. For this reason, SQL Server supports the creation of up to 30,000 statistics on non-indexed columns. Better estimation with filtered statistics can lead to faster query execution against star schema based data warehouses, in many cases by estimating the optimal join strategy, amount of memory and executing the query in parallel.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/Oz2Z19l5IwU" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/filtered-statistics-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parallel Insert Into &#8211; Table Variable Vs Temporary Table in SQL Server</title>
		<link>http://blog.sqlworkshops.com/parallel-insert-into-table-variable-vs-temporary-table-in-sql-server/</link>
		<comments>http://blog.sqlworkshops.com/parallel-insert-into-table-variable-vs-temporary-table-in-sql-server/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:34:42 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=230</guid>
		<description><![CDATA[In SQL Server, for insert into select statements, when the target for insert into is temporary table, the select statement can execute in parallel. When the target is table variable, SQL Server will not execute the select statement in parallel, &#8230; <a href="http://blog.sqlworkshops.com/parallel-insert-into-table-variable-vs-temporary-table-in-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In SQL Server, for insert into select statements, when the target for insert into is temporary table, the select statement can execute in parallel. When the target is table variable, SQL Server will not execute the select statement in parallel, which can lead to poor performance.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/45UMnfz23i4" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/parallel-insert-into-table-variable-vs-temporary-table-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cardinality Estimation &#8211; Table Variable Vs Temporary Table in SQL Serve</title>
		<link>http://blog.sqlworkshops.com/cardinality-estimation-table-variable-vs-temporary-table-in-sql-serve/</link>
		<comments>http://blog.sqlworkshops.com/cardinality-estimation-table-variable-vs-temporary-table-in-sql-serve/#comments</comments>
		<pubDate>Sun, 15 May 2016 18:34:06 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=225</guid>
		<description><![CDATA[SQL Server creates and maintains statistics for temporary tables, which lead to better cardinality estimation and optimal execution plan generation. Table variables have no statistics, which can result in poor cardinality estimation and non-optimal execution plan creation. When you add &#8230; <a href="http://blog.sqlworkshops.com/cardinality-estimation-table-variable-vs-temporary-table-in-sql-serve/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>SQL Server creates and maintains statistics for temporary tables, which lead to better cardinality estimation and optimal execution plan generation. Table variables have no statistics, which can result in poor cardinality estimation and non-optimal execution plan creation. When you add query hint option (recompile) when using table variable, SQL Server can use heuristics based estimates, taking into consideration the total number of rows in the table variable; this can be helpful in some scenarios.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/jZKPmC6pCBg" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out www.sqlvideo.com for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/cardinality-estimation-table-variable-vs-temporary-table-in-sql-serve/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding ASYNC_NETWORK_IO Waits in SQL Server</title>
		<link>http://blog.sqlworkshops.com/understanding-async_network_io-waits-in-sql-server/</link>
		<comments>http://blog.sqlworkshops.com/understanding-async_network_io-waits-in-sql-server/#comments</comments>
		<pubDate>Sun, 15 May 2016 04:52:40 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=198</guid>
		<description><![CDATA[In SQL Server, ASYNC_NETWORK_IO wait time can be high due to slow network, like when the database is in the cloud and the application is on premise. Furthermore, it can be slow when CPU utilization is high in the application &#8230; <a href="http://blog.sqlworkshops.com/understanding-async_network_io-waits-in-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In SQL Server, ASYNC_NETWORK_IO wait time can be high due to slow network, like when the database is in the cloud and the application is on premise. Furthermore, it can be slow when CPU utilization is high in the application server preventing timely fetching of all rows or, in most cases, when the application reads a row, does some work processing the row, before reading the next row. When the server sends data, the ASYNC_NETWORK_IO wait time will not increase beyond 2000ms. After 2000ms the server will increase the wait count and reset the wait time, which is demonstrated in the video.</p>
<p>The below video covers ASYNC_NETWORK_IO waits while the server is sending data to the client. The video suggests ways to identify slow network and discusses high ASYNC_NETWORK_IO wait time and guidelines to reduce the waits.</p>
<p>SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/difEyUkr64g" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out <a href="http://www.sqlvideo.com"><span style="text-decoration: underline;"><span style="color: #0066cc;">http://www.sqlvideo.com</span></span></a> for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/understanding-async_network_io-waits-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resource Governor in SQL Server &#8211; Workload Throttling</title>
		<link>http://blog.sqlworkshops.com/resource-governor-in-sql-server-workload-throttling/</link>
		<comments>http://blog.sqlworkshops.com/resource-governor-in-sql-server-workload-throttling/#comments</comments>
		<pubDate>Sat, 14 May 2016 17:48:14 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=196</guid>
		<description><![CDATA[Resource Governor in SQL Server provides CPU, Memory and I/O throttling. In SQL Server 2014 and earlier, CPU throttling works only for similar kind of workloads and not for mixed workloads, where high importance workload group gets 9 slices of &#8230; <a href="http://blog.sqlworkshops.com/resource-governor-in-sql-server-workload-throttling/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Resource Governor in SQL Server provides CPU, Memory and I/O throttling. In SQL Server 2014 and earlier, CPU throttling works only for similar kind of workloads and not for mixed workloads, where high importance workload group gets 9 slices of CPU, medium importance gets 3 slices and low 1 slice. In SQL Server 2016, CPU throttling works fine for all kinds of workloads.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/MnUBmK_hcMM" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out <a href="http://www.sqlvideo.com"><span style="text-decoration: underline;"><span style="color: #0066cc;">http://www.sqlvideo.com</span></span></a> for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/resource-governor-in-sql-server-workload-throttling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Compression in SQL Server &#8211; Pros and Cons</title>
		<link>http://blog.sqlworkshops.com/data-compression-in-sql-server-pros-and-cons/</link>
		<comments>http://blog.sqlworkshops.com/data-compression-in-sql-server-pros-and-cons/#comments</comments>
		<pubDate>Tue, 10 May 2016 14:12:09 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=194</guid>
		<description><![CDATA[SQL Server supports row and page compression on tables, indexes and partitions. This can lead to reduced I/O and better performance. However, it can also result in additional CPU usage in some cases, outweighing the benefits of data compression. SQL &#8230; <a href="http://blog.sqlworkshops.com/data-compression-in-sql-server-pros-and-cons/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>SQL Server supports row and page compression on tables, indexes and partitions. This can lead to reduced I/O and better performance. However, it can also result in additional CPU usage in some cases, outweighing the benefits of data compression. SQL Server query optimizer does not cost the overhead of expanding the compressed data, which can lead to plan regression as shown in the video.</p>
<p>The below video demonstrates this with hands-on example. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/lnwq1YQvBHc" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out <a href="http://www.sqlvideo.com"><span style="text-decoration: underline;"><span style="color: #0066cc;">http://www.sqlvideo.com</span></span></a> for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/data-compression-in-sql-server-pros-and-cons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server Command Timeout &#8211; Application Timeout &#8211; Attention</title>
		<link>http://blog.sqlworkshops.com/sql-server-command-timeout-application-timeout-attention/</link>
		<comments>http://blog.sqlworkshops.com/sql-server-command-timeout-application-timeout-attention/#comments</comments>
		<pubDate>Mon, 09 May 2016 19:41:15 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=191</guid>
		<description><![CDATA[When you use ODBC or SqlClient to access data from SQL Server, by default the query will be cancelled if there is no response from the server within a certain period of time (30 seconds by default). ODBC or SqlClient &#8230; <a href="http://blog.sqlworkshops.com/sql-server-command-timeout-application-timeout-attention/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>When you use ODBC or SqlClient to access data from SQL Server, by default the query will be cancelled if there is no response from the server within a certain period of time (30 seconds by default). ODBC or SqlClient will start a timer after sending the query to SQL Server and if there are no results from the server within 30 seconds, the query will be cancelled and a timeout error message will be sent to the application. In case a network packet (containing query results) was received within the 30 seconds, and if we are expecting additional network packets (additional rows that couldn’t fit in the first network packet), then the timer is restarted, if the next network packet is not received within this 30 second period, the query will be cancelled.</p>
<p>The common reasons for SQL Command timeout are non-optimal schema or inefficient queries that execute for a long period of time or that miss indexes or lock wait issues. It is important to tune the queries rather than increase the SQL Command timeout settings.</p>
<p>In the video an example is demonstrated where decreasing the network packet size eliminates the timeout, this demonstration is to understand how network packets are involved in resetting the timer and to develop better understanding of timeout. Changing the network packet size is not a solution to avoid timeout, tuning non-optimal schema or inefficient queries or adding indexes or avoiding lock waits are the proper solution.</p>
<p>To identify the command that leads to SQL Command timeout error, you can use Extended Events and monitor event ‘sqlserver.attention’. The extended event script used in the video is available at www.sqlvideo.com/xevents.</p>
<p>In SQL Server Management Studio, the SQL Command timeout can be changed using ‘Options’ in the connection dialog. By default, this is set to ‘0’, which means no timeout. When a query or stored procedure is executing, if you click the ‘Cancel’ button (the red square), the same attention will be sent to the SQL Server (like SQL Command Timeout). And this will in-turn generate ‘sqlserver.attention’ event in Extended Events.</p>
<p>In the below video you can see an example of the SQL Command timeout. SQLTest Tool simulates the hands-on labs for you, no registration necessary. You can practice the online hands-on example while watching the video.</p>
<p><iframe src="//www.youtube.com/embed/7TKdl2nhiZM" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Check out <a href="http://www.sqlvideo.com"><span style="text-decoration: underline;"><span style="color: #0066cc;">http://www.sqlvideo.com</span></span></a> for additional hands-on videos.</p>
<p>Subscribe to our newsletter: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/sql-server-command-timeout-application-timeout-attention/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slow performance due to SQL Server 2014 Buffer Pool Extension (BPE) and serial queries (MAXDOP 1)</title>
		<link>http://blog.sqlworkshops.com/slow-performance-due-to-sql-server-2014-buffer-pool-extension-bpe-and-serial-queries-maxdop-1/</link>
		<comments>http://blog.sqlworkshops.com/slow-performance-due-to-sql-server-2014-buffer-pool-extension-bpe-and-serial-queries-maxdop-1/#comments</comments>
		<pubDate>Thu, 04 Dec 2014 13:41:43 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=165</guid>
		<description><![CDATA[The SQL Server 2014 Buffer Pool Extension feature can extend the buffer pool space on to Solid State Drive (SSD), where data and index pages can be cached. There is no possibility of data loss in the event of SSD &#8230; <a href="http://blog.sqlworkshops.com/slow-performance-due-to-sql-server-2014-buffer-pool-extension-bpe-and-serial-queries-maxdop-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>The SQL Server 2014 Buffer Pool Extension feature can extend the buffer pool space on to Solid State Drive (SSD), where data and index pages can be cached. There is no possibility of data loss in the event of SSD failure as the cached data is clean (unmodified pages).</p>
<p>Buffer Pool Extension can provide better random I/O performance by decreasing the latency for such I/O operations using SSD.<br />
Buffer Pool Extension is not suitable for large sequential reads with lesser degree of parallelism. When the required data pages are in BPE, single threads are performing only 1 I/O operation at a given time and that I/O operation is limited to 1 page (8KB), leading to too many small I/Os and decreased throughput. The wait type used while waiting for BPE I/Os to complete is ‘EC’.</p>
<p><iframe src="//www.youtube.com/embed/xXALq9H3sxA" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>To receive the example scripts used in the video, subscribe to our mailing list: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
<p>If a table’s size is 16GB and, let’s say, about half of that table is in BPE, a serial query (MAXDOP = 1) will access this 8GB, 1 page at a time. The reason being that there is no purpose in copying the 8GB that is in the BPE back to the actual buffer pool as it will have to replace useful pages that are already there. To read pages from the BPE without affecting the actual buffer pool, every thread is using 1 page of memory buffer to read 1 page from the BPE, processes that page and then issues the next read request to the BPE and so on. If you observe the read queue length of the SSD volume, you will notice, while such a serial query is executing, the read queue length will never exceed 1 and average bytes per read will always be 8KB.</p>
<p>Such queries will be many times faster without Buffer Pool Extension; BPE can slow down such queries. In our example, with 8GB total memory for SQL Server and 16GB BPE, a range scan covering half of a 16GB table without BPE takes about 15 seconds, whereas with BPE it takes about a minute with MAXDOP = 1. A full scan on such a table without BPE takes about 30 seconds, whereas with BPE it takes more than 5 to 10 minutes in some instances with MAXDOP = 1. The reason being that SQL Server’s access to spinning disks leads to better throughput as the I/Os are not limited to 8KB, they can be up to 512KB (provided the data pages are not fragmented) and outstanding I/Os are not limited to 1.</p>
<p>The data in the Buffer Pool Extension related to a table might not be contiguous and hence it might not be possible to issue larger I/Os.</p>
<p>The best way to mitigate this issue is to use parallel query execution with a large number of worker threads when performing large table or range scans when BPE is enabled. This effectively increases the number of outstanding I/Os from 1 to the number of parallel threads executing the query and keeps the SSD busy with many outstanding I/Os, even though the I/O size does not change and remains at 8KB.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/slow-performance-due-to-sql-server-2014-buffer-pool-extension-bpe-and-serial-queries-maxdop-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NUMA remote (foreign) memory access overhead on Windows, SQL Server and In-Memory OLTP</title>
		<link>http://blog.sqlworkshops.com/numa-remote-foreign-memory-access-overhead-on-windows-sql-server-and-in-memory-oltp/</link>
		<comments>http://blog.sqlworkshops.com/numa-remote-foreign-memory-access-overhead-on-windows-sql-server-and-in-memory-oltp/#comments</comments>
		<pubDate>Thu, 04 Dec 2014 13:41:21 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=163</guid>
		<description><![CDATA[In NUMA (Non-Uniform Memory Access), processors in the same physical location are grouped in a node which has its own local node memory. In a NUMA based system, there will be more than one such node and these nodes will &#8230; <a href="http://blog.sqlworkshops.com/numa-remote-foreign-memory-access-overhead-on-windows-sql-server-and-in-memory-oltp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In NUMA (Non-Uniform Memory Access), processors in the same physical location are grouped in a node which has its own local node memory. In a NUMA based system, there will be more than one such node and these nodes will use a shared interconnect mechanism to transfer data between them. In such a case, a processor accessing its local node memory will be much faster than the same processor accessing memory from remote node.</p>
<p><iframe src="//www.youtube.com/embed/-nvNdaP8ZNU" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>To receive the example scripts used in the video, subscribe to our mailing list: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
<p>Reference: <a href="https://software.intel.com/en-us/articles/optimizing-applications-for-numa/">https://software.intel.com/en-us/articles/optimizing-applications-for-numa</a></p>
<p>Most operating systems optimize memory allocation on a NUMA based system, such that when a thread executing on a processor allocates memory, the operating system will try to allocate the memory from the processor’s local node unless there is a memory availability issue, in which case it will allocate memory from a remote node.</p>
<p>Using a simple Windows application, we can demonstrate that a thread running on a processor accessing remote memory is 15%+ more expensive than accessing its local memory depending on the processor model.</p>
<p><iframe src="//www.youtube.com/embed/IZMMUy-Wwc8" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe><br />
To receive the example scripts used in the video, subscribe to our mailing list: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
<p>In SQL Server, when memory is allocated for caching data, it is allocated from the local node whenever it is possible. In cases where a query scans a table serially (MAXDOP = 1) and where memory is allocated for data cache, memory is always allocated from the local node when possible. This might lead the table to reside entirely in one memory node. When a thread executing a query, retrieving data from this table, happens to be on a different node, the data access becomes expensive.</p>
<p>Remote memory is referred to as “foreign memory” in SQL Server. Too much foreign node memory allocation by itself does not indicate an issues as the threads that are accessing this memory can be from any node. SQL Server does some amount of optimization regarding NUMA, like when a query executes in parallel, it keeps all the threads on a single node when possible.</p>
<p>Like explained above, when a table is cached on a single NUMA node part of a large table or range scan and later accessed from another node part of the large table or range scan, like using serial execution (MAXDOP = 1), the performance penalty can be 15%+ memory depending on the processor model. To mitigate this issue it is recommended to scan the table in parallel (MAXDOP greater than the number of processors in a NUMA node) so the data is not isolated to a single NUMA node.<br />
On the positive side, one can isolate a table to a single NUMA node using Resource Governor and access that table always using processors in that node and avoid this 15%+ penalty. On a 2 node NUMA system this can lead to 7.5%+ overall improvement.</p>
<p><iframe src="//www.youtube.com/embed/Lz3XAObEL_A" height="315" width="560" allowfullscreen="allowfullscreen" frameborder="0"></iframe><br />
To receive the example scripts used in the video, subscribe to our mailing list: <a href="https://newsletter.sqlworkshops.com/">https://newsletter.sqlworkshops.com</a></p>
<p>This applies to SQL Server 2014 In-Memory OLTP technology as well, with a slight variation. With regular tables, non-memory optimized tables, where data is not in the cache; it is loaded into the cache on demand (whenever someone accesses the data). Hence, it is important to distribute the data across all NUMA nodes during query execution for predictable performance.</p>
<p>With memory optimized tables, data is loaded by SQL Server at startup, during this time SQL Server distributes data across all NUMA nodes.</p>
<p>The problem with memory optimized tables and data distribution across NUMA nodes occurs only during initial data load into the table. This problem disappears after SQL Server restart as explained above. Since queries execute serially (always MAXDOP = 1) in In-Memory OLTP, there is a possibility that all the data inserted by a single thread will reside on a single NUMA node.</p>
<p>Since In-Memory OLTP technology uses native code, there are less processor instructions; this magnifies the performance impact on foreign memory access. With In-Memory OLTP technology, this penalty can be even 30%+ depending on the processor model.</p>
<p>Usually foreign memory access should not be an issue with In-Memory OLTP usage as one should not perform large table or range scans.<br />
Again, like with normal table and large scans, it is recommended to load the table with many threads, which sometimes means splitting large inserts into small parts and executing then in separate batches.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/numa-remote-foreign-memory-access-overhead-on-windows-sql-server-and-in-memory-oltp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server 2012: Indirect Checkpoint (Target Recovery Time), get the real scoop</title>
		<link>http://blog.sqlworkshops.com/sql-server-2012-indirect-checkpoint-target-recovery-time-get-the-real-scoop/</link>
		<comments>http://blog.sqlworkshops.com/sql-server-2012-indirect-checkpoint-target-recovery-time-get-the-real-scoop/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 21:58:48 +0000</pubDate>
		<dc:creator>R Meyyappan</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.sqlworkshops.com/?p=161</guid>
		<description><![CDATA[SQL Server 2012 brings a new feature called Indirect Checkpoint. You can read more about it here: http://msdn.microsoft.com/en-us/library/ms189573.aspx. With Indirect Checkpoint, you get smaller and too many I/Os Checkpoint normally writes large blocks of data to disk optimally in single &#8230; <a href="http://blog.sqlworkshops.com/sql-server-2012-indirect-checkpoint-target-recovery-time-get-the-real-scoop/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>SQL Server 2012 brings a new feature called Indirect Checkpoint. You can read more about it here: <a href="http://msdn.microsoft.com/en-us/library/ms189573.aspx">http://msdn.microsoft.com/en-us/library/ms189573.aspx</a>.</p>
<p><strong>With Indirect Checkpoint, you get smaller and too many I/Os</strong></p>
<p>Checkpoint normally writes large blocks of data to disk optimally in single write operation, up to 256KB, depending on the number of contiguous dirty pages in cache that needs to be flushed to disk. Once you turn on the indirect checkpoint feature by setting target recovery time to a non-zero value, the checkpoint writes will turn into single page writes, 8KB writes.</p>
<p>This will lead to too many I/Os. We all know few large I/Os are more efficient than many small I/Os. This may slow down overall write throughput and performance. If you are hosting your server on the cloud based virtual servers, this means, it will increase the cost as you pay by the number of I/O operations you incur.</p>
<p><strong>Too many outstanding I/Os</strong></p>
<p>Normally check point throttles the number of outstanding I/Os by setting threshold based on write latency in order not to overload the storage subsystem. But once you enable indirect checkpoint, SQL Server can queue up hundreds of thousands of I/Os. This will not only overload the storage subsystem, if users want to read data from the database, their I/O requests will be queued up way behind  the indirect checkpoint writes and they may experience very slow response time and timeouts.</p>
<p>You might also see such errors in the errorlog as large number of I/Os in the queue may take a long time to complete:</p>
<p><span style="color: #ff0000;">A time-out occurred while waiting for buffer latch &#8212; type 4, bp 0000000283508040, page 1:1080, stat 0x60d, database id: 16, allocation unit Id: 0/281474976710656, task 0x00000002321BC558 : 0, waittime 300 seconds, flags 0x1a, owning task 0x00000002321BC558. Not continuing to wait.</span></p>
<p><strong>High CPU usage</strong></p>
<p>When you enable indirect checkpoint, you might encounter high CPU usage. One of the CPUs that is performing the write might spin at 100%. This can be monitored by measuring DP_LIST spins as shown below, more than 4 billion spins were noticed by running the below test just once. Also the writers will use much more CPU.</p>
<p>select * from sys.dm_os_spinlock_stats where name = &#8216;DP_LIST&#8217;</p>
<p>You will notice the updates are much slower when indirect checkpoint is enabled.</p>
<p>In extreme cases when you try to restart the SQL Server service, it will take a long time to stop. Meanwhile you can neither connect nor start the service as the service is already in the process of stopping, flushing the dirty pages before shutdown.</p>
<p><strong>You can use the below scripts to reproduce the scenario</strong></p>
<p>use master</p>
<p>if  exists (select * from sys.databases where name = &#8216;sqlworkshops&#8217;)</p>
<p>drop database sqlworkshops</p>
<p>go</p>
<p>use master</p>
<p>create database sqlworkshops on primary (name = &#8216;sqlworkshops_1&#8242;, filename = &#8216;P:sqlworkshops_1.mdf&#8217;, size = 5GB)</p>
<p>log on (name = &#8216;sqlworkshops_log_1&#8242;, filename = &#8216;Q:sqlworkshops_log_1.ldf&#8217;, size = 64MB)</p>
<p>go</p>
<p>use master</p>
<p>alter database sqlworkshops set recovery simple</p>
<p>go</p>
<p>use sqlworkshops</p>
<p>if  exists (select * from sys.objects where name = &#8216;tab71&#8242;)</p>
<p>drop table tab71</p>
<p>go</p>
<p>use sqlworkshops</p>
<p>create table tab71 (c1 int primary key clustered, c2 int, c3 char(2000))</p>
<p>insert into tab71 with (tablock) select top 500000 row_number() over (order by c1.object_id, c2.o) as c1, 1 as c2, replicate(&#8216;a&#8217;, 2000) as c3</p>
<p>from sys.all_columns c1, sys.all_columns c2</p>
<p>update statistics tab71 with fullscan</p>
<p>checkpoint</p>
<p>go</p>
<p>use sqlworkshops</p>
<p>if  exists (select * from sys.objects where name = &#8216;tab72&#8242;)</p>
<p>drop table tab72</p>
<p>go</p>
<p>use sqlworkshops</p>
<p>create table tab72 (c1 int primary key clustered, c2 int, c3 char(2000))</p>
<p>insert into tab72 with (tablock) select top 500000 row_number() over (order by c1.object_id) as c1, 1 as c2, replicate(&#8216;a&#8217;, 2000) as c3</p>
<p>from sys.all_columns c1, sys.all_columns c2</p>
<p>update statistics tab72 with fullscan</p>
<p>checkpoint</p>
<p>go</p>
<p>&nbsp;</p>
<p>&#8211;Session 1:</p>
<p>use sqlworkshops</p>
<p>update tab71 set c2 = 2</p>
<p>go</p>
<p>use sqlworkshops</p>
<p>update tab71 set c2 = 3</p>
<p>go</p>
<p>&nbsp;</p>
<p>&#8211;Session 2 (optional):</p>
<p>use sqlworkshops</p>
<p>update tab72 set c2 = 2</p>
<p>go</p>
<p>use sqlworkshops</p>
<p>update tab72 set c2 = 3</p>
<p>go</p>
<p>&nbsp;</p>
<p>&#8211;To monitor spins:</p>
<p>select * from sys.dm_os_wait_stats</p>
<p>where wait_type = &#8216;DIRTY_PAGE_POLL&#8217;</p>
<p>go</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sqlworkshops.com/sql-server-2012-indirect-checkpoint-target-recovery-time-get-the-real-scoop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
