<?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>Cluster Index &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/cluster-index/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, 05 Feb 2018 19:18:00 +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>Database Design: Common Practices for Database Developers and Application Developers</title>
		<link>https://www.dbrnd.com/2016/12/database-design-common-practices-for-database-developers-and-application-developers/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 26 Dec 2016 17:37:29 +0000</pubDate>
				<category><![CDATA[Database Designing]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Application Developer]]></category>
		<category><![CDATA[Cluster Index]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database concept]]></category>
		<category><![CDATA[Database Design]]></category>
		<category><![CDATA[Database Developer]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database standards]]></category>
		<category><![CDATA[Database Theory]]></category>
		<category><![CDATA[database topic]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Performance Optimization]]></category>
		<category><![CDATA[RDBMS]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4117</guid>

					<description><![CDATA[<div><img width="448" height="318" src="https://www.dbrnd.com/wp-content/uploads/2016/12/DatabaseDesignBestPractices.jpg" class="attachment-post-image size-post-image wp-post-image" alt="Database Design Best Practices" decoding="async" fetchpriority="high" srcset="https://www.dbrnd.com/wp-content/uploads/2016/12/DatabaseDesignBestPractices.jpg 448w, https://www.dbrnd.com/wp-content/uploads/2016/12/DatabaseDesignBestPractices-300x213.jpg 300w, https://www.dbrnd.com/wp-content/uploads/2016/12/DatabaseDesignBestPractices-150x106.jpg 150w" sizes="(max-width: 448px) 100vw, 448px" /></div>In this post, I am sharing the list of common practices for Database Designing which should follow by Database Developers and Application Developers. Foreign keys should have indexes on them, and it should often cover multiple columns base on the queries you need to execute. You should make sure about the referential integrity by enforcing [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="448" height="318" src="https://www.dbrnd.com/wp-content/uploads/2016/12/DatabaseDesignBestPractices.jpg" class="attachment-post-image size-post-image wp-post-image" alt="Database Design Best Practices" decoding="async" srcset="https://www.dbrnd.com/wp-content/uploads/2016/12/DatabaseDesignBestPractices.jpg 448w, https://www.dbrnd.com/wp-content/uploads/2016/12/DatabaseDesignBestPractices-300x213.jpg 300w, https://www.dbrnd.com/wp-content/uploads/2016/12/DatabaseDesignBestPractices-150x106.jpg 150w" sizes="(max-width: 448px) 100vw, 448px" /></div><p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fdatabase-design-common-practices-for-database-developers-and-application-developers%2F&amp;linkname=Database%20Design%3A%20Common%20Practices%20for%20Database%20Developers%20and%20Application%20Developers" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fdatabase-design-common-practices-for-database-developers-and-application-developers%2F&amp;linkname=Database%20Design%3A%20Common%20Practices%20for%20Database%20Developers%20and%20Application%20Developers" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fdatabase-design-common-practices-for-database-developers-and-application-developers%2F&amp;linkname=Database%20Design%3A%20Common%20Practices%20for%20Database%20Developers%20and%20Application%20Developers" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fdatabase-design-common-practices-for-database-developers-and-application-developers%2F&amp;linkname=Database%20Design%3A%20Common%20Practices%20for%20Database%20Developers%20and%20Application%20Developers" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fdatabase-design-common-practices-for-database-developers-and-application-developers%2F&amp;linkname=Database%20Design%3A%20Common%20Practices%20for%20Database%20Developers%20and%20Application%20Developers" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fdatabase-design-common-practices-for-database-developers-and-application-developers%2F&amp;linkname=Database%20Design%3A%20Common%20Practices%20for%20Database%20Developers%20and%20Application%20Developers" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fdatabase-design-common-practices-for-database-developers-and-application-developers%2F&#038;title=Database%20Design%3A%20Common%20Practices%20for%20Database%20Developers%20and%20Application%20Developers" data-a2a-url="https://www.dbrnd.com/2016/12/database-design-common-practices-for-database-developers-and-application-developers/" data-a2a-title="Database Design: Common Practices for Database Developers and Application Developers"></a></p><p>In this post, I am sharing the list of common practices for Database Designing which should follow by Database Developers and Application Developers.</p>
<ul>
<li>Foreign keys should have indexes on them, and it should often cover multiple columns base on the queries you need to execute.</li>
<li>You should make sure about the referential integrity by enforcing the Foreign Keys.<br />
Choose right column for CLUSTER Index.</li>
<li>You should apply proper indexes and do not create duplicate indexes and avoid creation of unnecessary indexes.</li>
<li>You should not put auto-number data type as a PRIMARY KEY to join a FOREIGN KEY in a parent/child table relationship.</li>
<li>If your system is running large number of INSERT/DELETE, you should avoid frequent update of database Statistics.</li>
<li>You should choose the write data-type for your data columns.</li>
<li>Please separate big size of columns from main table and store in a different table.</li>
<li>You should apply proper column name.</li>
<li>Use proper data types for Latitude, Longitude, IP-Address, Network Address, Mac Address.</li>
<li>Use Natural Primary key rather than Surrogate Primary key. Natural Primary keys are keys base on an external meaningful data. Surrogate Primary key are keys base on an auto-increment number or values which have no meaning outside the system.</li>
<li>You must use Stored Procedures or Stored Functions.</li>
<li>Please avoid too much database normalization and try to design your database to achieve Database Normalization + Database Denormalization. You should design this combination to achieve the performance.</li>
<li>Avoid inappropriate or excessive use of cursors.</li>
<li>Avoid inappropriate use of Database Transactions (BEGIN&#8230;COMMIT).</li>
<li>Try to avoid the use of OR condition because an AND condition restricts the data set, whereas an OR condition grows it.</li>
<li>You should do detailed performance analysis on queries.</li>
<li>Try to use the Prepared SQL Statement which caches the compiled query and the execution plan for better performance. It will also better protect you against SQL injection attacks.</li>
<li>Please do not simplify your complex queries through the views.</li>
<li>Please do not use DISTINCT frequently. Many developers are using DISTINCT to hide duplicate data, but you should stop and remove the duplicate data.</li>
<li>Try to avoid Correlated Subqueries.</li>
<li>Do not store comma delimited list in a table.</li>
<li>Do not store JSON data in TEXT COLUMN, you should use JSON data type for it.</li>
<li>Please do not use comma separated table names in SELECT query, use explicit JOINs conditions to avoid internal Cartesian products.</li>
</ul>
<p>&nbsp;<br />
<strong>The list is not final yet, you guys can add/share a comment and make it final&#8230;</strong></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: CLUSTER &#8211; Improve Index Performance (No default cluster index)</title>
		<link>https://www.dbrnd.com/2016/12/postgresql-cluster-improve-index-performance-no-default-cluster-index-explicit-lock-physical-order-data/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 02 Dec 2016 04:22:42 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[CLUSTER]]></category>
		<category><![CDATA[Cluster Index]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[explicit lock]]></category>
		<category><![CDATA[fragmentation]]></category>
		<category><![CDATA[Index Performance]]></category>
		<category><![CDATA[Order of data]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[Primary key]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3964</guid>

					<description><![CDATA[I have received a few emails related to PostgreSQL default cluster index and I have received from the developers of Microsoft SQL Server. If you are Microsoft SQL Server developer, you know that Primary key of the Table is working as Cluster Index and resides in the same data page where data actually stored. In [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fpostgresql-cluster-improve-index-performance-no-default-cluster-index-explicit-lock-physical-order-data%2F&amp;linkname=PostgreSQL%3A%20CLUSTER%20%E2%80%93%20Improve%20Index%20Performance%20%28No%20default%20cluster%20index%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%2F2016%2F12%2Fpostgresql-cluster-improve-index-performance-no-default-cluster-index-explicit-lock-physical-order-data%2F&amp;linkname=PostgreSQL%3A%20CLUSTER%20%E2%80%93%20Improve%20Index%20Performance%20%28No%20default%20cluster%20index%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%2F2016%2F12%2Fpostgresql-cluster-improve-index-performance-no-default-cluster-index-explicit-lock-physical-order-data%2F&amp;linkname=PostgreSQL%3A%20CLUSTER%20%E2%80%93%20Improve%20Index%20Performance%20%28No%20default%20cluster%20index%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%2F2016%2F12%2Fpostgresql-cluster-improve-index-performance-no-default-cluster-index-explicit-lock-physical-order-data%2F&amp;linkname=PostgreSQL%3A%20CLUSTER%20%E2%80%93%20Improve%20Index%20Performance%20%28No%20default%20cluster%20index%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%2F2016%2F12%2Fpostgresql-cluster-improve-index-performance-no-default-cluster-index-explicit-lock-physical-order-data%2F&amp;linkname=PostgreSQL%3A%20CLUSTER%20%E2%80%93%20Improve%20Index%20Performance%20%28No%20default%20cluster%20index%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%2F2016%2F12%2Fpostgresql-cluster-improve-index-performance-no-default-cluster-index-explicit-lock-physical-order-data%2F&amp;linkname=PostgreSQL%3A%20CLUSTER%20%E2%80%93%20Improve%20Index%20Performance%20%28No%20default%20cluster%20index%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%2F2016%2F12%2Fpostgresql-cluster-improve-index-performance-no-default-cluster-index-explicit-lock-physical-order-data%2F&#038;title=PostgreSQL%3A%20CLUSTER%20%E2%80%93%20Improve%20Index%20Performance%20%28No%20default%20cluster%20index%29" data-a2a-url="https://www.dbrnd.com/2016/12/postgresql-cluster-improve-index-performance-no-default-cluster-index-explicit-lock-physical-order-data/" data-a2a-title="PostgreSQL: CLUSTER – Improve Index Performance (No default cluster index)"></a></p><p><em>I have received a few emails related to PostgreSQL default cluster index and I have received from the developers of Microsoft SQL Server.<br />
If you are Microsoft SQL Server developer, you know that Primary key of the Table is working as Cluster Index and resides in the same data page where data actually stored. </em></p>
<p><strong>In PostgreSQL, There is no concept like: Table Primary Key means default Cluster Index of that table. </strong><br />
<strong>In PostgreSQL, we have one CLUSTER command which is similar to Cluster Index.</strong> </p>
<blockquote><p>Once you create your table primary key or any other Index, you can execute the CLUSTER command by specifying that Index name to achieve the physical order of the Table Data. </p></blockquote>
<blockquote><p>CLUSTER instructs PostgreSQL to cluster the table specified by table_name based on the index specified by index_name. The index must already have been defined on table_name.</p></blockquote>
<blockquote><p>A clustering on an index forces the physical ordering of the data and you can have only one clustered index per table and should carefully pick which index you will use to cluster.</p></blockquote>
<blockquote><p>When a table is clustered, it is physically reordered based on the index information. Clustering is a one-time operation: when the table is subsequently updated, the changes are not clustered. That is, no attempt is made to store new or updated rows according to their index order. </p></blockquote>
<blockquote><p>If you wish, you can periodically recluster by issuing the CLUSTER command again and again. </p></blockquote>
<blockquote><p>A executing of CLUSTER command requires an ACCESS EXCLUSIVE lock on the table because It reorders your data. You can also get some free space by issuing CLUSTER because It rearranges the data in a particular order. </p></blockquote>
<blockquote><p>When you execute the CLUSTER command, It creates a temporary copy of the table therefore, you need free space on disk at least equal to the original table size. </p></blockquote>
<blockquote><p>When an index scan is used, a temporary copy of the table is created that contains the table data in the index order. Temporary copies of each index on the table are created as well. Therefore, you need free space on disk at least equal to the sum of the table size and the index sizes.</p></blockquote>
<blockquote><p>It is advisable to set maintenance_work_mem to a reasonably large value before clustering.</p></blockquote>
<blockquote><p>Once you are done with your CLUSTER, you should execute the ANALYZE command on that table because planner records statistics about the ordering of tables.
</p></blockquote>
<p><strong>Syntax of Cluster:</strong><br />
First time you must execute CLUSTER using the Index Name.</p>
<pre class="crayon-plain-tag">CLUSTER table_name USING index_name;</pre> </p>
<p><strong>Cluster the table:</strong><br />
Once you have executed CLUSTER with Index, next time you should execute only CLUSTER TABLE because It knows that which index already defined as CLUSTER.</p>
<pre class="crayon-plain-tag">CLUSTER table_name;</pre> </p>
<p><strong>Cluster all tables of database:</strong></p>
<pre class="crayon-plain-tag">CLUSTER;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
