<?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>SQL Server 2016 &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/sql-server-2016/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:21:14 +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 2016: Enable System-versioned Temporal Table on existing Table</title>
		<link>https://www.dbrnd.com/2018/03/sql-server-2016-enable-system-versioned-temporal-table-on-existing-table-system_versioning-history_table/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 07 Mar 2018 16:16:19 +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[history table]]></category>
		<category><![CDATA[history_table]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></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[system_versioning]]></category>
		<category><![CDATA[system-versioned temporal table]]></category>
		<category><![CDATA[track data change]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4284</guid>

					<description><![CDATA[SQL Server 2016 introduced System-versioned Temporal Table to keep a history of data change by adding additional history table. In the below article, You can read more about System-versioned Temporal Table and you must know all the rules before creating a System-versioned Temporal Table. You can also enable System-versioned Temporal Table in the existing table. [&#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%2F2018%2F03%2Fsql-server-2016-enable-system-versioned-temporal-table-on-existing-table-system_versioning-history_table%2F&amp;linkname=SQL%20Server%202016%3A%20Enable%20System-versioned%20Temporal%20Table%20on%20existing%20Table" 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-2016-enable-system-versioned-temporal-table-on-existing-table-system_versioning-history_table%2F&amp;linkname=SQL%20Server%202016%3A%20Enable%20System-versioned%20Temporal%20Table%20on%20existing%20Table" 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-2016-enable-system-versioned-temporal-table-on-existing-table-system_versioning-history_table%2F&amp;linkname=SQL%20Server%202016%3A%20Enable%20System-versioned%20Temporal%20Table%20on%20existing%20Table" 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-2016-enable-system-versioned-temporal-table-on-existing-table-system_versioning-history_table%2F&amp;linkname=SQL%20Server%202016%3A%20Enable%20System-versioned%20Temporal%20Table%20on%20existing%20Table" 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-2016-enable-system-versioned-temporal-table-on-existing-table-system_versioning-history_table%2F&amp;linkname=SQL%20Server%202016%3A%20Enable%20System-versioned%20Temporal%20Table%20on%20existing%20Table" 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-2016-enable-system-versioned-temporal-table-on-existing-table-system_versioning-history_table%2F&amp;linkname=SQL%20Server%202016%3A%20Enable%20System-versioned%20Temporal%20Table%20on%20existing%20Table" 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-2016-enable-system-versioned-temporal-table-on-existing-table-system_versioning-history_table%2F&#038;title=SQL%20Server%202016%3A%20Enable%20System-versioned%20Temporal%20Table%20on%20existing%20Table" data-a2a-url="https://www.dbrnd.com/2018/03/sql-server-2016-enable-system-versioned-temporal-table-on-existing-table-system_versioning-history_table/" data-a2a-title="SQL Server 2016: Enable System-versioned Temporal Table on existing Table"></a></p><p>SQL Server 2016 introduced System-versioned Temporal Table to keep a history of data change by adding additional history table.</p>
<p>In the below article, You can read more about System-versioned Temporal Table and you must know all the rules before creating a System-versioned Temporal Table.</p>
<p>You can also enable System-versioned Temporal Table in the existing table.</p>
<p><strong>Check this demonstration:</strong></p>
<p><strong>Create a table with sample data:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Employees
(
	EmpID INT PRIMARY KEY
	,EmpName VARCHAR(20)
	,EmpDepartment VARCHAR(20)
	,EmpSalary INT
)
GO
 
INSERT INTO tbl_Employees
VALUES 
(1,'Anvesh','Database',90000)
,(2,'Jenny','JAVA',65000)
,(3,'Martin','PHP',85000)
,(4,'Roy','PHP',94000)
GO</pre> </p>
<p><strong>Enable System-versioned Temporal Table on this table:</strong></p>
<pre class="crayon-plain-tag">ALTER TABLE tbl_Employees
SET (SYSTEM_VERSIONING = ON (HISTORY_TABLE=dbo.tbl_EmployeesHistory))
GO</pre> </p>
<p>You will get a below error because you must configure SYSTEM_TIME column. </p>
<pre class="crayon-plain-tag">Msg 13510, Level 16, State 1, Line 1
Cannot set SYSTEM_VERSIONING to ON when SYSTEM_TIME period is not defined.</pre> </p>
<p><strong>Configure SYSTEM_TIME column:</strong></p>
<pre class="crayon-plain-tag">ALTER TABLE tbl_Employees
ADD 
	StartTime DATETIME2 GENERATED ALWAYS AS ROW START DEFAULT GETUTCDATE()
	,EndTime DATETIME2 GENERATED ALWAYS AS ROW END DEFAULT CONVERT(DATETIME2, '9999-12-31 23:59:59.9999999') 
	,PERIOD FOR SYSTEM_TIME (StartTime, EndTime)  
GO</pre> </p>
<p><strong>Now, enable System-versioned Temporal Table:</strong></p>
<pre class="crayon-plain-tag">ALTER TABLE tbl_Employees
SET (SYSTEM_VERSIONING = ON (HISTORY_TABLE=dbo.tbl_EmployeesHistory))
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: System-versioned Temporal Table to store History of data change</title>
		<link>https://www.dbrnd.com/2018/03/sql-server-2016-system-versioned-temporal-table-to-store-history-of-data-change/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 05 Mar 2018 16:16:36 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Change data capture]]></category>
		<category><![CDATA[Data change audit]]></category>
		<category><![CDATA[data history]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[DDL Changes]]></category>
		<category><![CDATA[history table]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></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[System-versioned]]></category>
		<category><![CDATA[Temporal Table]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4261</guid>

					<description><![CDATA[<div><img width="651" height="398" src="https://www.dbrnd.com/wp-content/uploads/2018/02/History.jpg" class="attachment-post-image size-post-image wp-post-image" alt="" decoding="async" fetchpriority="high" /></div>SQL Server 2016 introduced a new type of user table that is called System-versioned Temporal Table to keep a full history of data changes. This is a very good addition to the SQL Server 2016 because to track data change history is always an important task for a big transactional system. SQL Server already provides [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="651" height="398" src="https://www.dbrnd.com/wp-content/uploads/2018/02/History.jpg" class="attachment-post-image size-post-image wp-post-image" alt="" decoding="async" /></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-2016-system-versioned-temporal-table-to-store-history-of-data-change%2F&amp;linkname=SQL%20Server%202016%3A%20System-versioned%20Temporal%20Table%20to%20store%20History%20of%20data%20change" 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-2016-system-versioned-temporal-table-to-store-history-of-data-change%2F&amp;linkname=SQL%20Server%202016%3A%20System-versioned%20Temporal%20Table%20to%20store%20History%20of%20data%20change" 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-2016-system-versioned-temporal-table-to-store-history-of-data-change%2F&amp;linkname=SQL%20Server%202016%3A%20System-versioned%20Temporal%20Table%20to%20store%20History%20of%20data%20change" 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-2016-system-versioned-temporal-table-to-store-history-of-data-change%2F&amp;linkname=SQL%20Server%202016%3A%20System-versioned%20Temporal%20Table%20to%20store%20History%20of%20data%20change" 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-2016-system-versioned-temporal-table-to-store-history-of-data-change%2F&amp;linkname=SQL%20Server%202016%3A%20System-versioned%20Temporal%20Table%20to%20store%20History%20of%20data%20change" 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-2016-system-versioned-temporal-table-to-store-history-of-data-change%2F&amp;linkname=SQL%20Server%202016%3A%20System-versioned%20Temporal%20Table%20to%20store%20History%20of%20data%20change" 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-2016-system-versioned-temporal-table-to-store-history-of-data-change%2F&#038;title=SQL%20Server%202016%3A%20System-versioned%20Temporal%20Table%20to%20store%20History%20of%20data%20change" data-a2a-url="https://www.dbrnd.com/2018/03/sql-server-2016-system-versioned-temporal-table-to-store-history-of-data-change/" data-a2a-title="SQL Server 2016: System-versioned Temporal Table to store History of data change"></a></p><p>SQL Server 2016 introduced a new type of user table that is called System-versioned Temporal Table to keep a full history of data changes.</p>
<p>This is a very good addition to the SQL Server 2016 because to track data change history is always an important task for a big transactional system.</p>
<p>SQL Server already provides few features to track data change like Change Data Capture (CDC), SQL Server Auditing, can create a manual DDL Trigger.</p>
<blockquote><p>Now, SQL Server 2016 System-versioned temporal table which is something good and very easy to implement on a specific table.<br />
You can audit all data changes and can perform require analysis on it. In Case of invalid delete or update, you can recover your data.</p></blockquote>
<p><strong>Rules and Requirements:</strong></p>
<ul>
<li>Can create your table using SYSTEM_VERSIONING=ON</li>
<li>Define your history table name HISTORY_TABLE = TableName, which tracks data change history. (It creates automatically).</li>
<li>Must define two additional columns [ValidFrom] and [ValidTo] with default ROW START and ROW END and must refer to as SYSTEM_TIME period columns.</li>
<li>Must have a Primary key column.</li>
<li>Same number of column and structure between both the tables.</li>
</ul>
<p><strong>Full demonstration:</strong></p>
<p><strong>Create a sampel System Version Table:</strong><br />
<pre class="crayon-plain-tag">CREATE TABLE tbl_Students
(
	StudID INT PRIMARY KEY
	,StudName VARCHAR(50)
	,StudClass CHAR(1)
	,ValidFrom DATETIME2 (2) GENERATED ALWAYS AS ROW START  
	,ValidTo DATETIME2 (2) GENERATED ALWAYS AS ROW END  
	,PERIOD FOR SYSTEM_TIME (ValidFrom, ValidTo)  
) WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.tbl_StudentsHistory));  
GO</pre>
<p><strong>Insert few sample records:</strong><br />
<pre class="crayon-plain-tag">INSERT INTO tbl_Students 
(StudID,StudName,StudClass)
VALUES (1,'Roy','A'),(2,'Bony','B'),(3,'Mahi','C')
,(4,'Maria','A'),(5,'Ron','B'),(6,'Murey','C')
GO</pre>
<p><strong>Execute few DML statements:</strong><br />
<pre class="crayon-plain-tag">UPDATE tbl_Students SET StudClass = 'B'
WHERE StudID = 4;
GO

DELETE FROM tbl_Students WHERE StudID = 2
GO</pre>
<p><strong>Check the result of both tables:</strong><br />
<pre class="crayon-plain-tag">SELECT *FROM tbl_StudentsHistory

StudID  StudName      StudClass ValidFrom                   ValidTo
------- ------------- --------- --------------------------- ---------------------------
4       Maria             A         2017-01-06 05:47:23.73      2017-01-06 05:48:54.43
2       Bony              B         2017-01-06 05:47:23.73      2017-01-06 05:50:12.52


SELECT *FROM tbl_Students

StudID  StudName        StudClass ValidFrom                   ValidTo
------- --------------- --------- --------------------------- ---------------------------
1       Roy                 A         2017-01-06 05:47:23.73      9999-12-31 23:59:59.99
3       Mahi                C         2017-01-06 05:47:23.73      9999-12-31 23:59:59.99
4       Maria               B         2017-01-06 05:48:54.43      9999-12-31 23:59:59.99
5       Ron                 B         2017-01-06 05:47:23.73      9999-12-31 23:59:59.99
6       Murey               C         2017-01-06 05:47:23.73      9999-12-31 23:59:59.99</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: Introduced Live Query Statistics, Monitor Live Query Execution</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-2016-introduced-live-query-statistics-monitor-live-query-execution-debug-sql-query/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 13 Jan 2018 16:16:44 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Actual Execution Plan]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Estimated Execution Plan]]></category>
		<category><![CDATA[Live Query Statistics]]></category>
		<category><![CDATA[Query Debugging]]></category>
		<category><![CDATA[Query Execution]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></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[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4226</guid>

					<description><![CDATA[SQL Server 2016 came with a lot of great features which will help us in our day to day activities. It introduced a fantastic feature to monitor live query execution using Live Query Statistics option. We knew about the Actual Execution Plan and Estimated Execution Plan, which gives us the full execution plan of the [&#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%2F2018%2F01%2Fsql-server-2016-introduced-live-query-statistics-monitor-live-query-execution-debug-sql-query%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Live%20Query%20Statistics%2C%20Monitor%20Live%20Query%20Execution" 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-2016-introduced-live-query-statistics-monitor-live-query-execution-debug-sql-query%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Live%20Query%20Statistics%2C%20Monitor%20Live%20Query%20Execution" 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-2016-introduced-live-query-statistics-monitor-live-query-execution-debug-sql-query%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Live%20Query%20Statistics%2C%20Monitor%20Live%20Query%20Execution" 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-2016-introduced-live-query-statistics-monitor-live-query-execution-debug-sql-query%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Live%20Query%20Statistics%2C%20Monitor%20Live%20Query%20Execution" 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-2016-introduced-live-query-statistics-monitor-live-query-execution-debug-sql-query%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Live%20Query%20Statistics%2C%20Monitor%20Live%20Query%20Execution" 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-2016-introduced-live-query-statistics-monitor-live-query-execution-debug-sql-query%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Live%20Query%20Statistics%2C%20Monitor%20Live%20Query%20Execution" 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-2016-introduced-live-query-statistics-monitor-live-query-execution-debug-sql-query%2F&#038;title=SQL%20Server%202016%3A%20Introduced%20Live%20Query%20Statistics%2C%20Monitor%20Live%20Query%20Execution" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-2016-introduced-live-query-statistics-monitor-live-query-execution-debug-sql-query/" data-a2a-title="SQL Server 2016: Introduced Live Query Statistics, Monitor Live Query Execution"></a></p><p>SQL Server 2016 came with a lot of great features which will help us in our day to day activities.<br />
It introduced a fantastic feature to monitor live query execution using Live Query Statistics option.</p>
<blockquote><p>We knew about the Actual Execution Plan and Estimated Execution Plan, which gives us the full execution plan of the query.<br />
Now, we have one more option in this category, which is Live Query Statistics.</p></blockquote>
<p>As per the MSDN,</p>
<blockquote><p>SQL Server Management Studio provides the ability to view the live execution plan of an active query.<br />
This live query plan provides real-time insights into the query execution process as the controls flow from one query plan operator to another.</p></blockquote>
<blockquote><p>We can get overall query progress in real time without needing to wait for the query to complete.<br />
When we are debugging the overall query execution, it helps a lot to debug every block of the query.
</p></blockquote>
<p><strong>How to enable Live Query Statistics option for the SQL Query?</strong></p>
<p><strong>Using SSMS:</strong></p>
<blockquote><p>In the SQL Editor toolbar, you can find one new button called &#8220;Include Live Query Statistics&#8221; which is immediately next to &#8220;Include Actual Execution Plan&#8221; button.
</p></blockquote>
<p><strong>Right click on SQL Query:</strong></p>
<blockquote><p>Select your query and right click on it. You can select an option like: &#8220;Include Live Query Statistics&#8221; for that particular query execution. </p></blockquote>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: sys.dm_db_column_store_row_group_physical_stats to find fragmentation of Columnstore Indexes</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-2016-sys-dm_db_column_store_row_group_physical_stats-to-find-fragmentation-of-columnstore-indexes/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 12 Jan 2018 16:16:26 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Columnstore Index]]></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 2016]]></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[SYS.INDEXES]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4223</guid>

					<description><![CDATA[SQL Server 2016 introduced sys.dm_db_column_store_row_group_physical_stats system view for finding the information on Columnstore row groups and related fragmentation. This is an extended version of sys.column_store_row_groups. Using this system view, you can find information like total number of rows physically stored, and a column for the number of rows marked as deleted. [crayon-6ab55e3bef204379645096/]]]></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%2F2018%2F01%2Fsql-server-2016-sys-dm_db_column_store_row_group_physical_stats-to-find-fragmentation-of-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_db_column_store_row_group_physical_stats%20to%20find%20fragmentation%20of%20Columnstore%20Indexes" 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-2016-sys-dm_db_column_store_row_group_physical_stats-to-find-fragmentation-of-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_db_column_store_row_group_physical_stats%20to%20find%20fragmentation%20of%20Columnstore%20Indexes" 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-2016-sys-dm_db_column_store_row_group_physical_stats-to-find-fragmentation-of-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_db_column_store_row_group_physical_stats%20to%20find%20fragmentation%20of%20Columnstore%20Indexes" 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-2016-sys-dm_db_column_store_row_group_physical_stats-to-find-fragmentation-of-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_db_column_store_row_group_physical_stats%20to%20find%20fragmentation%20of%20Columnstore%20Indexes" 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-2016-sys-dm_db_column_store_row_group_physical_stats-to-find-fragmentation-of-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_db_column_store_row_group_physical_stats%20to%20find%20fragmentation%20of%20Columnstore%20Indexes" 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-2016-sys-dm_db_column_store_row_group_physical_stats-to-find-fragmentation-of-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_db_column_store_row_group_physical_stats%20to%20find%20fragmentation%20of%20Columnstore%20Indexes" 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-2016-sys-dm_db_column_store_row_group_physical_stats-to-find-fragmentation-of-columnstore-indexes%2F&#038;title=SQL%20Server%202016%3A%20sys.dm_db_column_store_row_group_physical_stats%20to%20find%20fragmentation%20of%20Columnstore%20Indexes" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-2016-sys-dm_db_column_store_row_group_physical_stats-to-find-fragmentation-of-columnstore-indexes/" data-a2a-title="SQL Server 2016: sys.dm_db_column_store_row_group_physical_stats to find fragmentation of Columnstore Indexes"></a></p><p>SQL Server 2016 introduced sys.dm_db_column_store_row_group_physical_stats system view for finding the information on Columnstore row groups and related fragmentation.<br />
This is an extended version of sys.column_store_row_groups.</p>
<blockquote><p>Using this system view, you can find information like total number of rows physically stored, and a column for the number of rows marked as deleted.</p></blockquote>
<pre class="crayon-plain-tag">SELECT 
	OBJECT_NAME([i].[object_id]) AS TableName
	,[i].[name] AS IndexName	
	,[csrgps].[state_desc]
	,[csrgps].[total_rows]
	,[csrgps].[deleted_rows]
	,[csrgps].[size_in_bytes]
	,[csrgps].[trim_reason_desc]
	,[csrgps].[transition_to_compressed_state_desc]
	,[csrgps].[has_vertipaq_optimization]	
	,[csrgps].[created_time]
	,[csrgps].[closed_time]
	,100 * (ISNULL(csrgps.[deleted_rows],0)) / total_rows AS 'IsFragmentation'
FROM sys.indexes AS i
INNER JOIN sys.dm_db_column_store_row_group_physical_stats AS csrgps
	ON [i].[object_id] = [csrgps].[object_id] 
		AND [i].index_id = [csrgps].index_id  
ORDER BY [TableName], [IndexName] 
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: sys.dm_column_store_object_pool to find memory pool usage by Columnstore Indexes</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-2016-sys-dm_column_store_object_pool-to-find-memory-pool-usage-by-columnstore-indexes/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 11 Jan 2018 16:16:58 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Columnstore Index]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[memory pool usage]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></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[sys.columns]]></category>
		<category><![CDATA[sys.index]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4219</guid>

					<description><![CDATA[SQL Server 2016 introduced sys.dm_column_store_object_pool system view for finding the memory pool usage by different types of Columnstore Index objects. I am sharing one T-SQL Script to find memory pool usage by Columnstore Indexes. You can find one object_type column in the result set of below query. The information of object_type column is: 1 = [&#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%2F2018%2F01%2Fsql-server-2016-sys-dm_column_store_object_pool-to-find-memory-pool-usage-by-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_column_store_object_pool%20to%20find%20memory%20pool%20usage%20by%20Columnstore%20Indexes" 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-2016-sys-dm_column_store_object_pool-to-find-memory-pool-usage-by-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_column_store_object_pool%20to%20find%20memory%20pool%20usage%20by%20Columnstore%20Indexes" 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-2016-sys-dm_column_store_object_pool-to-find-memory-pool-usage-by-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_column_store_object_pool%20to%20find%20memory%20pool%20usage%20by%20Columnstore%20Indexes" 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-2016-sys-dm_column_store_object_pool-to-find-memory-pool-usage-by-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_column_store_object_pool%20to%20find%20memory%20pool%20usage%20by%20Columnstore%20Indexes" 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-2016-sys-dm_column_store_object_pool-to-find-memory-pool-usage-by-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_column_store_object_pool%20to%20find%20memory%20pool%20usage%20by%20Columnstore%20Indexes" 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-2016-sys-dm_column_store_object_pool-to-find-memory-pool-usage-by-columnstore-indexes%2F&amp;linkname=SQL%20Server%202016%3A%20sys.dm_column_store_object_pool%20to%20find%20memory%20pool%20usage%20by%20Columnstore%20Indexes" 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-2016-sys-dm_column_store_object_pool-to-find-memory-pool-usage-by-columnstore-indexes%2F&#038;title=SQL%20Server%202016%3A%20sys.dm_column_store_object_pool%20to%20find%20memory%20pool%20usage%20by%20Columnstore%20Indexes" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-2016-sys-dm_column_store_object_pool-to-find-memory-pool-usage-by-columnstore-indexes/" data-a2a-title="SQL Server 2016: sys.dm_column_store_object_pool to find memory pool usage by Columnstore Indexes"></a></p><p>SQL Server 2016 introduced sys.dm_column_store_object_pool system view for finding the memory pool usage by different types of Columnstore Index objects.</p>
<blockquote><p>I am sharing one T-SQL Script to find memory pool usage by Columnstore Indexes.<br />
You can find one object_type column in the result set of below query. </p></blockquote>
<p><strong>The information of object_type column is:</strong></p>
<blockquote><p>1 = COLUMN_SEGMENT<br />
	2 = COLUMN_SEGMENT_PRIMARY_DICTIONARY<br />
	3 = COLUMN_SEGMENT_SECONDARY_DICTIONARY<br />
	4 = COLUMN_SEGMENT_BULKINSERT_DICTIONARY<br />
	5 = COLUMN_SEGMENT_DELETE_BITMAP </p></blockquote>
<pre class="crayon-plain-tag">SELECT 
	OBJECT_NAME(csop.[object_id]) AS TableName
	,[i].[name] AS IndexName
	,[c].[name] AS ColumnName
	,[csop].[column_id]
	,[csop].[row_group_id]
	,[csop].[object_type_desc]
	,[csop].[access_count]
	,[csop].[memory_used_in_bytes]
	,[csop].[object_load_time]
FROM sys.dm_column_store_object_pool AS csop
LEFT OUTER JOIN sys.index_columns AS ic
	ON [ic].[index_column_id] = [csop].[column_id] 
		AND [ic].[index_id] = [csop].[index_id] 
		AND [ic].[object_id] = [csop].[object_id]
LEFT OUTER JOIN sys.columns AS c
	ON [ic].[object_id] = [c].[object_id] 
		AND [ic].[column_id] = [c].[column_id]
LEFT OUTER JOIN sys.indexes AS i
	ON [i].[object_id] = [csop].[object_id] 
		AND [i].[index_id] = [csop].[index_id]
ORDER BY [csop].[memory_used_in_bytes] DESC
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: Columnstore Index on Memory Optimized In Memory OLTP Tables</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-2016-columnstore-index-on-memory-optimized-in-memory-oltp-tables/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 07 Jan 2018 16:16:46 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[column store index]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Hekaton]]></category>
		<category><![CDATA[In-Memory Database]]></category>
		<category><![CDATA[memory database]]></category>
		<category><![CDATA[Memory Optimized Table]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2014]]></category>
		<category><![CDATA[SQL Server 2016]]></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[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4201</guid>

					<description><![CDATA[<div><img width="675" height="400" src="https://www.dbrnd.com/wp-content/uploads/2017/12/SQLRam.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQLRam" decoding="async" /></div>Microsoft SQL Server 2016 comes with a variety of new additions and I am happy for exploring the new features of SQL Server 2016. Microsoft SQL Server 2014 introduced Hekaton engine which used for In-Memory Database objects. SQL Server 2014: Create Memory Optimized File Group and Table SQL Server 2016 introduced Columnstore index for Memory-Optimized [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="675" height="400" src="https://www.dbrnd.com/wp-content/uploads/2017/12/SQLRam.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQLRam" decoding="async" loading="lazy" /></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-2016-columnstore-index-on-memory-optimized-in-memory-oltp-tables%2F&amp;linkname=SQL%20Server%202016%3A%20Columnstore%20Index%20on%20Memory%20Optimized%20In%20Memory%20OLTP%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%2F2018%2F01%2Fsql-server-2016-columnstore-index-on-memory-optimized-in-memory-oltp-tables%2F&amp;linkname=SQL%20Server%202016%3A%20Columnstore%20Index%20on%20Memory%20Optimized%20In%20Memory%20OLTP%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%2F2018%2F01%2Fsql-server-2016-columnstore-index-on-memory-optimized-in-memory-oltp-tables%2F&amp;linkname=SQL%20Server%202016%3A%20Columnstore%20Index%20on%20Memory%20Optimized%20In%20Memory%20OLTP%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%2F2018%2F01%2Fsql-server-2016-columnstore-index-on-memory-optimized-in-memory-oltp-tables%2F&amp;linkname=SQL%20Server%202016%3A%20Columnstore%20Index%20on%20Memory%20Optimized%20In%20Memory%20OLTP%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%2F2018%2F01%2Fsql-server-2016-columnstore-index-on-memory-optimized-in-memory-oltp-tables%2F&amp;linkname=SQL%20Server%202016%3A%20Columnstore%20Index%20on%20Memory%20Optimized%20In%20Memory%20OLTP%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%2F2018%2F01%2Fsql-server-2016-columnstore-index-on-memory-optimized-in-memory-oltp-tables%2F&amp;linkname=SQL%20Server%202016%3A%20Columnstore%20Index%20on%20Memory%20Optimized%20In%20Memory%20OLTP%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%2F2018%2F01%2Fsql-server-2016-columnstore-index-on-memory-optimized-in-memory-oltp-tables%2F&#038;title=SQL%20Server%202016%3A%20Columnstore%20Index%20on%20Memory%20Optimized%20In%20Memory%20OLTP%20Tables" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-2016-columnstore-index-on-memory-optimized-in-memory-oltp-tables/" data-a2a-title="SQL Server 2016: Columnstore Index on Memory Optimized In Memory OLTP Tables"></a></p><p>Microsoft SQL Server 2016 comes with a variety of new additions and I am happy for exploring the new features of SQL Server 2016.</p>
<p>Microsoft SQL Server 2014 introduced Hekaton engine which used for In-Memory Database objects.</p>
<blockquote class="wp-embedded-content" data-secret="dA5hDdDtd2"><p><a href="https://www.dbrnd.com/2016/01/sql-server-2014-create-memory-optimized-file-group-and-table/">SQL Server 2014: Create Memory Optimized File Group and Table</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/01/sql-server-2014-create-memory-optimized-file-group-and-table/embed/#?secret=dA5hDdDtd2" data-secret="dA5hDdDtd2" width="600" height="338" title="&#8220;SQL Server 2014: Create Memory Optimized File Group and Table&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>SQL Server 2016 introduced Columnstore index for Memory-Optimized Table which was not possible previously.<br />
If you are planning to store large amount of data In Memory, you can apply Columnstore Index on that In Memory OLTP Table.</p></blockquote>
<blockquote><p>It comes with one condition: you can not apply Columnstore Index on the particular column. It must apply to all the columns of In-Memory Table.</p></blockquote>
<p><strong>Small demonstration with all the possible errors:</strong></p>
<p><strong>Create a sample memory optimized table with column store index:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Employees
(
	EmpID INT
	,EmpName VARCHAR(50)
	,EmpSalary INT
	,EmpDOJ DATETIME
	,INDEX idx_tbl_Employees_columnstore CLUSTERED COLUMNSTORE 
)
WITH (MEMORY_OPTIMIZED = ON)
GO</pre> </p>
<p><strong>You will get a below error:</strong></p>
<pre class="crayon-plain-tag">Msg 41321, Level 16, State 7, Line 1
The memory optimized table 'tbl_Employees' with DURABILITY=SCHEMA_AND_DATA must have a primary key.</pre> </p>
<p><strong>Add primary key on script and execute it:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Employees
(
	EmpID INT PRIMARY KEY
	,EmpName VARCHAR(50)
	,EmpSalary INT
	,EmpDOJ DATETIME
	,INDEX idx_tbl_Employees_columnstore CLUSTERED COLUMNSTORE 
)
WITH (MEMORY_OPTIMIZED = ON)
GO</pre> </p>
<p><strong>You will get a below error:</strong></p>
<pre class="crayon-plain-tag">Msg 12317, Level 16, State 78, Line 3
Clustered indexes, which are the default for primary keys, are not supported with memory optimized tables. Specify a NONCLUSTERED index instead.</pre> </p>
<p><strong>Apply Non Clustered Primary key and execute it:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Employees
(
	EmpID INT PRIMARY KEY NONCLUSTERED
	,EmpName VARCHAR(50)
	,EmpSalary INT
	,EmpDOJ DATETIME
	,INDEX idx_tbl_Employees_columnstore CLUSTERED COLUMNSTORE 
)
WITH (MEMORY_OPTIMIZED = ON)
GO</pre> </p>
<p><strong>If you have not created Memory Optimized File group and related files, you may get a below error:</strong></p>
<pre class="crayon-plain-tag">Msg 41337, Level 16, State 100, Line 1
Cannot create memory optimized tables. To create memory optimized tables, the database must have a MEMORY_OPTIMIZED_FILEGROUP that is online and has at least one container.</pre> </p>
<p><strong>Create memory optimized file group and data files:<br />
</strong></p><pre class="crayon-plain-tag">USE [master]
GO
ALTER DATABASE [Database_Name] 
ADD FILEGROUP [Memory_Optimized] CONTAINS MEMORY_OPTIMIZED_DATA 
GO
ALTER DATABASE [Database_Name] 
ADD FILE ( NAME = N'HekatonMemory', FILENAME = N'C:\Hekaton\hek.mdf' ) 
TO FILEGROUP [Memory_Optimized]
GO</pre><p> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: Script to get information of Cached Functions (Total Execution Time)</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-2016-script-to-get-information-of-cached-functions-total-execution-time/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 06 Jan 2018 16:16:34 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[cache function]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[dm_exec_function_stats]]></category>
		<category><![CDATA[function execution count]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></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[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4195</guid>

					<description><![CDATA[SQL Server 2016 introduced one new DMV is sys.dm_exec_function_stats which returns the aggregate performance statistics for cached functions. It is very similar to sys.dm_exec_query_stats and it returns information about scalar functions, In-Memory functions and CLR functions. You can also get the number of execution count of functions which helps you to troubleshoot performance related problems. [&#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%2F2018%2F01%2Fsql-server-2016-script-to-get-information-of-cached-functions-total-execution-time%2F&amp;linkname=SQL%20Server%202016%3A%20Script%20to%20get%20information%20of%20Cached%20Functions%20%28Total%20Execution%20Time%29" 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-2016-script-to-get-information-of-cached-functions-total-execution-time%2F&amp;linkname=SQL%20Server%202016%3A%20Script%20to%20get%20information%20of%20Cached%20Functions%20%28Total%20Execution%20Time%29" 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-2016-script-to-get-information-of-cached-functions-total-execution-time%2F&amp;linkname=SQL%20Server%202016%3A%20Script%20to%20get%20information%20of%20Cached%20Functions%20%28Total%20Execution%20Time%29" 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-2016-script-to-get-information-of-cached-functions-total-execution-time%2F&amp;linkname=SQL%20Server%202016%3A%20Script%20to%20get%20information%20of%20Cached%20Functions%20%28Total%20Execution%20Time%29" 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-2016-script-to-get-information-of-cached-functions-total-execution-time%2F&amp;linkname=SQL%20Server%202016%3A%20Script%20to%20get%20information%20of%20Cached%20Functions%20%28Total%20Execution%20Time%29" 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-2016-script-to-get-information-of-cached-functions-total-execution-time%2F&amp;linkname=SQL%20Server%202016%3A%20Script%20to%20get%20information%20of%20Cached%20Functions%20%28Total%20Execution%20Time%29" 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-2016-script-to-get-information-of-cached-functions-total-execution-time%2F&#038;title=SQL%20Server%202016%3A%20Script%20to%20get%20information%20of%20Cached%20Functions%20%28Total%20Execution%20Time%29" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-2016-script-to-get-information-of-cached-functions-total-execution-time/" data-a2a-title="SQL Server 2016: Script to get information of Cached Functions (Total Execution Time)"></a></p><p>SQL Server 2016 introduced one new DMV is sys.dm_exec_function_stats which returns the aggregate performance statistics for cached functions.</p>
<blockquote><p>It is very similar to sys.dm_exec_query_stats and it returns information about scalar functions, In-Memory functions and CLR functions. </p></blockquote>
<p>You can also get the number of execution count of functions which helps you to troubleshoot performance related problems. </p>
<pre class="crayon-plain-tag">SELECT TOP 30
	d.object_id
	,d.database_id
	,OBJECT_NAME(object_id, database_id) AS FunctionName
	,d.cached_time
	,d.last_execution_time
	,d.total_elapsed_time
	,d.total_elapsed_time/d.execution_count AS [avg_elapsed_time]
	,d.last_elapsed_time, d.execution_count  
FROM sys.dm_exec_function_stats AS d  
ORDER BY [total_worker_time] DESC;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2014: Introduced DBCC CLONEDATABASE TO generate only Schema and Statistics</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 02 Jan 2018 16:16:21 +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[dbcc]]></category>
		<category><![CDATA[DBCC CLONEDATABASE]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Query Store]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[SNAPSHOT]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2014]]></category>
		<category><![CDATA[SQL Server 2016]]></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[Statistics]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4139</guid>

					<description><![CDATA[<div><img width="452" height="336" src="https://www.dbrnd.com/wp-content/uploads/2018/01/SQL-Server-Clone-Database.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQL Server Clone Database" decoding="async" loading="lazy" /></div>SQL Server 2014 introduced DBCC CLONEDATABASE for creating a blank database with only Schema and Statistics. SQL Server 2016 added support of the Query Store in DBCC CLONEDATABASE. This feature is very helpful in certain conditions. For example, Your production database size is around 800 GB, and You faced some performance related issues because the [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="452" height="336" src="https://www.dbrnd.com/wp-content/uploads/2018/01/SQL-Server-Clone-Database.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQL Server Clone Database" decoding="async" loading="lazy" /></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-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&#038;title=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store/" data-a2a-title="SQL Server 2014: Introduced DBCC CLONEDATABASE TO generate only Schema and Statistics"></a></p><p><em>SQL Server 2014 introduced DBCC CLONEDATABASE for creating a blank database with only Schema and Statistics.</p>
<p>SQL Server 2016 added support of the Query Store in DBCC CLONEDATABASE.</em></p>
<blockquote><p>
This feature is very helpful in certain conditions.<br />
For example, Your production database size is around 800 GB, and You faced some performance related issues because the problem of outdated Statistics or Indexes issue.</p></blockquote>
<blockquote><p>Now the situation is, you can do a test and trial in your Production Database, so DBA takes a copy of Production Database and restore it in different server for further investigation.</p></blockquote>
<blockquote><p>Do you think, this is the only one solution because Its require additional time and infrastructure.</p></blockquote>
<blockquote><p>In this kind of situation, you can use the DBCC CLONEDATABASE feature of SQL Server 2014.</p></blockquote>
<blockquote><p>It creates a blank database copy with the only Schema, Statistics and Query Store information. It is not copying the data, so it does not require any additional space.</p></blockquote>
<blockquote><p>You can find the same statistical information in the new clone database which generates the same execution plan for your investigation.</p>
<p>A Query Execution Plan is prepared to base on Database Statistics so If Database Statistics are same then you check your query execution plan without data.</p></blockquote>
<p>Once you are finished with your task with Clone Database, you can delete it.</p>
<p><strong>How internally SQL Server creates a Clone Database?</strong></p>
<blockquote><p>It validates the source database and acquires the shared lock on the source database</p>
<p>	It creates a snapshot of the source database (Include only: Schema, Statistics, Query Store)</p>
<p>	Create Clone Database and acquires an exclusive lock on it</p>
<p>	Copy the metadata, schema, statistics, query store information from the source database to clone database</p>
<p>	Release all locks from Clone Database</p></blockquote>
<p><strong>How to create a Clone Database?</strong></p>
<p>Use DBCC CLONEDATABASE command to create a Clone Database.<br />
<pre class="crayon-plain-tag">DBCC CLONEDATABASE (MyDatabase,MyDatabase_Clone);</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: New COMPRESS and DECOMPRESS function for the Column level Compression</title>
		<link>https://www.dbrnd.com/2017/11/sql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 06 Nov 2017 16:16:32 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[COMPRESS]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[DECOMPRESS]]></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[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6109</guid>

					<description><![CDATA[SQL Server 2016 introduced the COMPRESS() and DECOMPRESS() function which we can use to compress column data of a table. The Compression of the column is not a good always and not a good for all the column. For that, there are different ways for compression. But we can use COMPRESS() on those columns which [&#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%2F11%2Fsql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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%2F11%2Fsql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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%2F11%2Fsql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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%2F11%2Fsql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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%2F11%2Fsql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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%2F11%2Fsql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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%2F11%2Fsql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&#038;title=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" data-a2a-url="https://www.dbrnd.com/2017/11/sql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression/" data-a2a-title="SQL Server 2016: New COMPRESS and DECOMPRESS function for the Column level Compression"></a></p><p>SQL Server 2016 introduced the COMPRESS() and DECOMPRESS() function which we can use to compress column data of a table.</p>
<p>The Compression of the column is not a good always and not a good for all the column. For that, there are different ways for compression.</p>
<blockquote><p>But we can use COMPRESS() on those columns which size are very big and which are not most in use.<br />
The reason is, compressed column requires to be decompressed using DECOMPRESS() while selecting the data which will reduce query performance.</p></blockquote>
<p>If we are facing a size related problem, we can think for COMPRESS() on those big size columns which are not most in use.</p>
<p><strong>Please check the below demonstration on COMPRESS() and DECOMPRESS():</strong></p>
<p><strong>Create a sample table:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_DumpData
(
	ID INT 
	,RandomData NVARCHAR(MAX)
	,CONSTRAINT pk_tbl_DumpData_ID PRIMARY KEY(ID)
)
GO</pre><p>
<strong>Insert dummy data:</strong></p><pre class="crayon-plain-tag">;WITH CTE AS
(
	SELECT 1 ID
	UNION all
	SELECT ID + 1
	FROM CTE   
	WHERE ID + 1 &lt;= 1000000
)
INSERT INTO tbl_DumpData(ID,RandomData)
SELECT 
	ID
	,CONCAT(CAST(NEWID() AS NVARCHAR(MAX)), ' - I am follower of dbrnd.com') AS RandomData
FROM CTE 
OPTION (MAXRECURSION 0)
GO</pre><p>
<strong>Create a sample table to store Compressed Data:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_DumpData_Compressed
(
	ID INT 
	,RandomData NVARCHAR(MAX)
	,CONSTRAINT pk_tbl_DumpData_Compressed_ID PRIMARY KEY(ID)
)
GO</pre><p>
<strong>Insert Compressed data from the original table:</strong></p><pre class="crayon-plain-tag">INSERT INTO tbl_DumpData_Compressed
SELECT ID, COMPRESS (RandomData) AS RandomData
FROM tbl_DumpData</pre><p>
<strong>Compare the size of both table:</strong><br />
You will get to know that, compressed table size is smaller than original table</p><pre class="crayon-plain-tag">SP_Spaceused 'tbl_DumpData'
GO
SP_Spaceused 'tbl_DumpData_Compressed'
GO</pre><p>
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6111" src="https://www.dbrnd.com/wp-content/uploads/2017/09/SQLCompressDecompress.png" alt="SQL Compress Decompress" width="506" height="115" /></p>
<p><strong>Now, do DECOMPRESS and select your data:</strong><br />
<pre class="crayon-plain-tag">SELECT
	ID
	,CAST(DECOMPRESS(RandomData) AS NVARCHAR(MAX)) AS RandomData 
FROM tbl_DumpData_Compressed</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: Introduced Data Compression Algorithm to reduce the size of Table</title>
		<link>https://www.dbrnd.com/2017/09/sql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 15 Sep 2017 16:16:34 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[DATA_COMPRESSION]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[REBUILD]]></category>
		<category><![CDATA[sp_estimate_data_compression_savings]]></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[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6089</guid>

					<description><![CDATA[To complete this article, you must visit my yesterday&#8217;s post where I explained about the use of sp_estimate_data_compression_savings system stored procedure of SQL Server. In this post, I continue my demonstration and am using the same example of a table from the previous post. SQL Server 2016 introduced the Data Compression algorithm for compressing or [&#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-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" 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-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" 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-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" 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-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" 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-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" 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-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" 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-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&#038;title=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" data-a2a-url="https://www.dbrnd.com/2017/09/sql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression/" data-a2a-title="SQL Server 2016: Introduced Data Compression Algorithm to reduce the size of Table"></a></p><p>To complete this article, you must visit my yesterday&#8217;s post where I explained about the use of sp_estimate_data_compression_savings system stored procedure of SQL Server.</p>
<p>In this post, I continue my demonstration and am using the same example of a table from the previous post. SQL Server 2016 introduced the Data Compression algorithm for compressing or reducing the size of an object.</p>
<p><a href="https://docs.microsoft.com/en-us/sql/relational-databases/data-compression/data-compression" target="_blank" rel="noopener noreferrer">For more detail &#8211; visit this official LINK.</a></p>
<p>In this previous post, We can see 40% space that we can reduce of a tbl_Dumpdata table.</p>
<p><strong>How? </strong></p>
<blockquote><p>I created a clustered index on that table, so for data compression, we have to REBUILD that index with option DATA_COMPRESSION.</p></blockquote>
<p><strong>Rebuild Index with DATA_COMPRESSION:</strong></p><pre class="crayon-plain-tag">ALTER INDEX pk_tbl_DumpData_ID 
ON dbo.tbl_DumpData
REBUILD PARTITION = ALL 
WITH (DATA_COMPRESSION = PAGE)
GO</pre><p>
<strong>Now, check the space for PAGE option:</strong><br />
Check the below result, you can find the same value of column size_with_current_compression_setting and size_with_requested_compression_setting.</p><pre class="crayon-plain-tag">EXEC sp_estimate_data_compression_savings 
    @schema_name = 'dbo', 
    @object_name = 'tbl_DumpData', 
    @index_id = NULL, 
    @partition_number = NULL, 
    @data_compression = 'PAGE'</pre><p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6091" src="https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompressionPageRebuild.png" alt="SQLData Compression Page Rebuild" width="843" height="42" srcset="https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompressionPageRebuild.png 843w, https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompressionPageRebuild-679x34.png 679w" sizes="auto, (max-width: 843px) 100vw, 843px" /></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
