<?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>Table Partition &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/table-partition/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>Mon, 18 Sep 2017 11:01:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.5</generator>
	<item>
		<title>SQL Server: Implement Table Partition in Non Enterprise Edition (Use Partitioned View)</title>
		<link>https://www.dbrnd.com/2017/09/sql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view/</link>
					<comments>https://www.dbrnd.com/2017/09/sql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 03 Sep 2017 16:16:45 +0000</pubDate>
				<category><![CDATA[Database Designing]]></category>
		<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[Partitioned View]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[Table Partition]]></category>
		<category><![CDATA[table partitioning]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6022</guid>

					<description><![CDATA[In this post, I am sharing a full demonstration of the concept of Partitioned view in SQL Server. Using Partitioned view, you can implement Table Partitioning in the Non-Enterprise Edition of SQL Server because Table Partition is the feature of SQL Server Enterprise Edition. Many small level companies are searching for this kind of solution, [&#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-implement-table-partition-in-non-enterprise-edition-use-partitioned-view%2F&amp;linkname=SQL%20Server%3A%20Implement%20Table%20Partition%20in%20Non%20Enterprise%20Edition%20%28Use%20Partitioned%20View%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%2F2017%2F09%2Fsql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view%2F&amp;linkname=SQL%20Server%3A%20Implement%20Table%20Partition%20in%20Non%20Enterprise%20Edition%20%28Use%20Partitioned%20View%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%2F2017%2F09%2Fsql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view%2F&amp;linkname=SQL%20Server%3A%20Implement%20Table%20Partition%20in%20Non%20Enterprise%20Edition%20%28Use%20Partitioned%20View%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%2F2017%2F09%2Fsql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view%2F&amp;linkname=SQL%20Server%3A%20Implement%20Table%20Partition%20in%20Non%20Enterprise%20Edition%20%28Use%20Partitioned%20View%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%2F2017%2F09%2Fsql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view%2F&amp;linkname=SQL%20Server%3A%20Implement%20Table%20Partition%20in%20Non%20Enterprise%20Edition%20%28Use%20Partitioned%20View%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%2F2017%2F09%2Fsql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view%2F&amp;linkname=SQL%20Server%3A%20Implement%20Table%20Partition%20in%20Non%20Enterprise%20Edition%20%28Use%20Partitioned%20View%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%2F2017%2F09%2Fsql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view%2F&#038;title=SQL%20Server%3A%20Implement%20Table%20Partition%20in%20Non%20Enterprise%20Edition%20%28Use%20Partitioned%20View%29" data-a2a-url="https://www.dbrnd.com/2017/09/sql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view/" data-a2a-title="SQL Server: Implement Table Partition in Non Enterprise Edition (Use Partitioned View)"></a></p><p>In this post, I am sharing a full demonstration of the concept of Partitioned view in SQL Server.</p>
<p>Using Partitioned view, you can implement Table Partitioning in the Non-Enterprise Edition of SQL Server because Table Partition is the feature of SQL Server Enterprise Edition.</p>
<p>Many small level companies are searching for this kind of solution, and the concept of Partitioned view is also giving a good performance. </p>
<blockquote><p>We can also say that this is a manual table partitioning where you must create separate physical tables basis on your require partition ranges and require to apply proper CHECK constraint for validating data ranges. </p>
<p>After this, using one view, you can access all table and accordingly query execution plan also access only require table which reduces the unnecessary load on all or whole table. </p></blockquote>
<p>Please check the below demonstration and try it your self.</p>
<p><strong>Create a SEQUENCE object:</strong></p><pre class="crayon-plain-tag">CREATE SEQUENCE dbo.seq_ProductHistory
    START WITH 1  
    INCREMENT BY 1 ;  
GO</pre><p>
<strong>Create four physical tables:</strong></p><pre class="crayon-plain-tag">CREATE TABLE dbo.tbl_ProductHistory_Q1
(
	ProductID INT
	,ProductName VARCHAR(20)
	,SoldDate DATE
	,ProductSoldQuarter TINYINT CHECK (ProductSoldQuarter = 1)
	,CONSTRAINT pk_tbl_ProductHistory_Q1_ProductID_ProductSoldQuarter PRIMARY KEY(ProductID, ProductSoldQuarter)
)
GO

CREATE TABLE dbo.tbl_ProductHistory_Q2
(
	ProductID INT 
	,ProductName VARCHAR(20)
	,SoldDate DATE
	,ProductSoldQuarter TINYINT CHECK (ProductSoldQuarter = 2)
	,CONSTRAINT pk_tbl_ProductHistory_Q2_ProductID_ProductSoldQuarter PRIMARY KEY(ProductID, ProductSoldQuarter)
)
GO

CREATE TABLE dbo.tbl_ProductHistory_Q3
(
	ProductID INT 
	,ProductName VARCHAR(20)
	,SoldDate DATE
	,ProductSoldQuarter TINYINT CHECK (ProductSoldQuarter = 3)
	,CONSTRAINT pk_tbl_ProductHistory_Q3_ProductID_ProductSoldQuarter PRIMARY KEY(ProductID, ProductSoldQuarter)
)
GO

CREATE TABLE dbo.tbl_ProductHistory_Q4
(
	ProductID INT 
	,ProductName VARCHAR(20)
	,SoldDate DATE
	,ProductSoldQuarter TINYINT CHECK (ProductSoldQuarter = 4)
	,CONSTRAINT pk_tbl_ProductHistory_Q4_ProductID_ProductSoldQuarter PRIMARY KEY(ProductID, ProductSoldQuarter)
)
GO</pre><p>
<strong>Create a Partitioned View:</strong></p><pre class="crayon-plain-tag">CREATE VIEW dbo.vw_ProductHistory
WITH SCHEMABINDING
AS
SELECT ProductID, ProductName, SoldDate, ProductSoldQuarter FROM dbo.tbl_ProductHistory_Q1
UNION ALL
SELECT ProductID, ProductName, SoldDate, ProductSoldQuarter FROM dbo.tbl_ProductHistory_Q2
UNION ALL
SELECT ProductID, ProductName, SoldDate, ProductSoldQuarter FROM dbo.tbl_ProductHistory_Q3
UNION ALL
SELECT ProductID, ProductName, SoldDate, ProductSoldQuarter FROM dbo.tbl_ProductHistory_Q4
GO</pre><p>
<strong>Use view and Insert data into four tables:</strong></p><pre class="crayon-plain-tag">INSERT INTO dbo.vw_ProductHistory 
VALUES (NEXT VALUE FOR dbo.seq_ProductHistory, 'Computer', '2017-01-08', 1)
GO

INSERT INTO dbo.vw_ProductHistory 
VALUES (NEXT VALUE FOR dbo.seq_ProductHistory, 'Laptop', '2017-04-14', 2)
GO

INSERT INTO dbo.vw_ProductHistory 
VALUES (NEXT VALUE FOR dbo.seq_ProductHistory, 'Pendrive', '2017-08-16', 3)
GO

INSERT INTO dbo.vw_ProductHistory 
VALUES (NEXT VALUE FOR dbo.seq_ProductHistory, 'Mobile', '2017-12-26', 4)
GO</pre><p>
<strong>SELECT all records from all four tables via view:</strong><br />
Check the execution plan, where you can see four different access on physical tables.</p><pre class="crayon-plain-tag">SELECT *FROM dbo.vw_ProductHistory</pre><p>
<strong>Result:</strong></p><pre class="crayon-plain-tag">ProductID   ProductName          SoldDate   ProductSoldQuarter
----------- -------------------- ---------- ------------------
1           Computer             2017-01-08 1
2           Laptop               2017-04-14 2
3           Pendrive             2017-08-16 3
4           Mobile               2017-12-26 4</pre><p>
<strong>Check the execution plan: It is accessing all four physical tables</strong></p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-6027" src="https://www.dbrnd.com/wp-content/uploads/2017/08/PartitionedViewAllScan.png" alt="" width="539" height="391" /></p>
<p><strong>SELECT few records:</strong><br />
Check the execution plan, where you can find only access of Quarter-4 table because we are selecting data only for it.</p><pre class="crayon-plain-tag">SELECT *FROM dbo.vw_ProductHistory 
WHERE ProductSoldQuarter = 4</pre><p>
<strong>Result:</strong></p><pre class="crayon-plain-tag">ProductID   ProductName          SoldDate   ProductSoldQuarter
----------- -------------------- ---------- ------------------
4           Mobile               2017-12-26 4</pre><p>
<strong>Check the execution plan: It is accessing only Quarter-4 table.</strong></p>
<p><img decoding="async" class="alignnone size-full wp-image-6026" src="https://www.dbrnd.com/wp-content/uploads/2017/08/PartitionedViewSingalScan.png" alt="" width="582" height="131" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/09/sql-server-implement-table-partition-in-non-enterprise-edition-use-partitioned-view/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server Interview: Difference between Filtered Index and Table Partition</title>
		<link>https://www.dbrnd.com/2017/03/sql-server-interview-difference-between-filtered-index-and-table-partition/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 18 Mar 2017 16:16:40 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Filtered Index]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[partition function]]></category>
		<category><![CDATA[Partition scheme]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[Table Partition]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4773</guid>

					<description><![CDATA[If you are SQL DBA and if I am taking your interview, definitely I will ask this question to you. If you don&#8217;t know about Filtered Index and how to create a Table Partition in SQL Server, please visit below articles: SQL Server: Filtered Indexes &#8211; Improved the query performance SQL Server 2016: Introduce New [&#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%2F03%2Fsql-server-interview-difference-between-filtered-index-and-table-partition%2F&amp;linkname=SQL%20Server%20Interview%3A%20Difference%20between%20Filtered%20Index%20and%20Table%20Partition" 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%2F03%2Fsql-server-interview-difference-between-filtered-index-and-table-partition%2F&amp;linkname=SQL%20Server%20Interview%3A%20Difference%20between%20Filtered%20Index%20and%20Table%20Partition" 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%2F03%2Fsql-server-interview-difference-between-filtered-index-and-table-partition%2F&amp;linkname=SQL%20Server%20Interview%3A%20Difference%20between%20Filtered%20Index%20and%20Table%20Partition" 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%2F03%2Fsql-server-interview-difference-between-filtered-index-and-table-partition%2F&amp;linkname=SQL%20Server%20Interview%3A%20Difference%20between%20Filtered%20Index%20and%20Table%20Partition" 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%2F03%2Fsql-server-interview-difference-between-filtered-index-and-table-partition%2F&amp;linkname=SQL%20Server%20Interview%3A%20Difference%20between%20Filtered%20Index%20and%20Table%20Partition" 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%2F03%2Fsql-server-interview-difference-between-filtered-index-and-table-partition%2F&amp;linkname=SQL%20Server%20Interview%3A%20Difference%20between%20Filtered%20Index%20and%20Table%20Partition" 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%2F03%2Fsql-server-interview-difference-between-filtered-index-and-table-partition%2F&#038;title=SQL%20Server%20Interview%3A%20Difference%20between%20Filtered%20Index%20and%20Table%20Partition" data-a2a-url="https://www.dbrnd.com/2017/03/sql-server-interview-difference-between-filtered-index-and-table-partition/" data-a2a-title="SQL Server Interview: Difference between Filtered Index and Table Partition"></a></p><p>If you are SQL DBA and if I am taking your interview, definitely I will ask this question to you.<br />
If you don&#8217;t know about Filtered Index and how to create a Table Partition in SQL Server, please visit below articles:</p>
<blockquote class="wp-embedded-content" data-secret="JVP5sA9RpP"><p><a href="https://www.dbrnd.com/2017/01/sql-server-filtered-indexes-improved-the-query-performance/">SQL Server: Filtered Indexes &#8211; Improved the query performance</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2017/01/sql-server-filtered-indexes-improved-the-query-performance/embed/#?secret=JVP5sA9RpP" data-secret="JVP5sA9RpP" width="600" height="338" title="&#8220;SQL Server: Filtered Indexes &#8211; Improved the query performance&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="n6fhw7WVTT"><p><a href="https://www.dbrnd.com/2016/01/sql-server-2016-introduce-new-truncate-by-partitions-number/">SQL Server 2016: Introduce New TRUNCATE  by Partitions Number</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-2016-introduce-new-truncate-by-partitions-number/embed/#?secret=n6fhw7WVTT" data-secret="n6fhw7WVTT" width="600" height="338" title="&#8220;SQL Server 2016: Introduce New TRUNCATE  by Partitions Number&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Filtered Index:</strong></p>
<ul>
<li>You can store a portion of your dataset in Filtered Index. For example, Created a filtered index on Gender column for only &#8216;Male&#8217;, then it stores only &#8216;Male&#8217; detailed index data.</li>
<li>Filtered index only applies to a subset of the base table which is not allowing a fast switching.</li>
<li>You can reduce the CPU I/O by reading a particular value of a Filtered Index.</li>
<li>The Filtered index stores only keys and reference of data.</li>
<li>Once you create a Filtered Index on the PartitionScheme, you have to create same Filtered Index for every new table partitions which create a problem because a combination of Filtered indexes may contain the different value.</li>
<li>If you already apply table partition, you should not apply filtered indexes on those partitions.</li>
</ul>
<p><strong>Table Partition:</strong></p>
<ul>
<li>The Table Partitioning breaks your main table into small groups of tables based on defined partitioning key.<br />
The data physically divided for better management and fast retrieval.</li>
<li>For example, you have a 20GB of a table, and it contains total 5 years of data so you can partition your table base on years which will create five table partitions with each size of 4GB.</li>
<li>To implement Table partitioning, you need to create .ndf files for each partition, partition function, partition scheme.</li>
<li>It stores all columns of your table in partitions; it is not just storing the key of data like Filtered Index.<br />
You can define indexes on each table partitions.</li>
<li>The maintenance of Table Partitions is costly and time taking.</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
