<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Primary Key and NonClustered Index in Simple Words</title>
	<atom:link href="http://blog.sqlauthority.com/2013/02/10/sql-server-primary-key-and-nonclustered-index-in-simple-words/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2013/02/10/sql-server-primary-key-and-nonclustered-index-in-simple-words/</link>
	<description>SQL, SQL Server, MySQL, Big Data and NoSQL</description>
	<lastBuildDate>Wed, 19 Jun 2013 04:23:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Maulik S</title>
		<link>http://blog.sqlauthority.com/2013/02/10/sql-server-primary-key-and-nonclustered-index-in-simple-words/#comment-503753</link>
		<dc:creator><![CDATA[Maulik S]]></dc:creator>
		<pubDate>Mon, 17 Jun 2013 08:26:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22650#comment-503753</guid>
		<description><![CDATA[Hie frnz,
Indeed a good post...I jst have a query..what if my table doesnt have any primary key,
then will my non clustered index work ??? plz let me know as m a new learner..

Thanks in advance,,]]></description>
		<content:encoded><![CDATA[<p>Hie frnz,<br />
Indeed a good post&#8230;I jst have a query..what if my table doesnt have any primary key,<br />
then will my non clustered index work ??? plz let me know as m a new learner..</p>
<p>Thanks in advance,,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derik Hammer</title>
		<link>http://blog.sqlauthority.com/2013/02/10/sql-server-primary-key-and-nonclustered-index-in-simple-words/#comment-421009</link>
		<dc:creator><![CDATA[Derik Hammer]]></dc:creator>
		<pubDate>Tue, 12 Feb 2013 14:47:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22650#comment-421009</guid>
		<description><![CDATA[One additional example of why you would want to have a PK and clustered index on different columns is if you have an insert heavy table with a GUID as your identifying column. GUIDs are non-sequential so having a clustered index on a GUID column can cause some significant performance hindrances due to the clustered index insert. This can also cause index fragmentation. In one particular system at my company we made the GUID the PK and created a clustered index on InsertDate DESC. This allowed us to quickly query the latest records due to the clustered sorting and removed the performance issue of the GUID. Even if the InsertDate is not unique, the clustered index will add a &quot;uniquifier&quot; in the index.]]></description>
		<content:encoded><![CDATA[<p>One additional example of why you would want to have a PK and clustered index on different columns is if you have an insert heavy table with a GUID as your identifying column. GUIDs are non-sequential so having a clustered index on a GUID column can cause some significant performance hindrances due to the clustered index insert. This can also cause index fragmentation. In one particular system at my company we made the GUID the PK and created a clustered index on InsertDate DESC. This allowed us to quickly query the latest records due to the clustered sorting and removed the performance issue of the GUID. Even if the InsertDate is not unique, the clustered index will add a &#8220;uniquifier&#8221; in the index.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rahul agrawal</title>
		<link>http://blog.sqlauthority.com/2013/02/10/sql-server-primary-key-and-nonclustered-index-in-simple-words/#comment-420670</link>
		<dc:creator><![CDATA[rahul agrawal]]></dc:creator>
		<pubDate>Mon, 11 Feb 2013 16:36:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22650#comment-420670</guid>
		<description><![CDATA[when have to make clustered with primary key and non cluster &amp; vice versa...]]></description>
		<content:encoded><![CDATA[<p>when have to make clustered with primary key and non cluster &amp; vice versa&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kavitha</title>
		<link>http://blog.sqlauthority.com/2013/02/10/sql-server-primary-key-and-nonclustered-index-in-simple-words/#comment-420649</link>
		<dc:creator><![CDATA[Kavitha]]></dc:creator>
		<pubDate>Mon, 11 Feb 2013 14:30:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22650#comment-420649</guid>
		<description><![CDATA[I have a doubt. please clarify. what you meant data pages here?
I think &#039;tables&#039;. 

thanks
Kavitha]]></description>
		<content:encoded><![CDATA[<p>I have a doubt. please clarify. what you meant data pages here?<br />
I think &#8216;tables&#8217;. </p>
<p>thanks<br />
Kavitha</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajmendra</title>
		<link>http://blog.sqlauthority.com/2013/02/10/sql-server-primary-key-and-nonclustered-index-in-simple-words/#comment-420434</link>
		<dc:creator><![CDATA[Rajmendra]]></dc:creator>
		<pubDate>Mon, 11 Feb 2013 03:09:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22650#comment-420434</guid>
		<description><![CDATA[Hi Pinal and frnds,
that was a nice Explanation thank you, i have a question i always face this the project i am running now major FMCG Project. what problem i face every month, i have created index on my sales table, where sale has to be entered in bulk at end of the month, so we can generate Reports and all, but when i try to insert  bulk data in table, it get slows because i have indexs on table, what is the best practice to solve this problem.

I do it by disabling index for the current time is it right?

Thank you,
Rajmendra]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal and frnds,<br />
that was a nice Explanation thank you, i have a question i always face this the project i am running now major FMCG Project. what problem i face every month, i have created index on my sales table, where sale has to be entered in bulk at end of the month, so we can generate Reports and all, but when i try to insert  bulk data in table, it get slows because i have indexs on table, what is the best practice to solve this problem.</p>
<p>I do it by disabling index for the current time is it right?</p>
<p>Thank you,<br />
Rajmendra</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2013/02/10/sql-server-primary-key-and-nonclustered-index-in-simple-words/#comment-420273</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Sun, 10 Feb 2013 15:46:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22650#comment-420273</guid>
		<description><![CDATA[Another common misconception most people have is &quot;Creating a primary key on a table makes reads fast&quot;

I want to clarify, Primary key is a constraint, it has nothing to do with fast reads. Like Pinal explained, &quot;Primary Key&quot; behind the scenes creates a clustered Index which makes the reads fast. Optionally we can also create non clustered for primary key which contributes to faster reads.

Finally, to compare indexes and Primary Key. You can create an index without a primary key but you cannot create a primary key without an index.

~ IM.]]></description>
		<content:encoded><![CDATA[<p>Another common misconception most people have is &#8220;Creating a primary key on a table makes reads fast&#8221;</p>
<p>I want to clarify, Primary key is a constraint, it has nothing to do with fast reads. Like Pinal explained, &#8220;Primary Key&#8221; behind the scenes creates a clustered Index which makes the reads fast. Optionally we can also create non clustered for primary key which contributes to faster reads.</p>
<p>Finally, to compare indexes and Primary Key. You can create an index without a primary key but you cannot create a primary key without an index.</p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arunraja (Rocket)</title>
		<link>http://blog.sqlauthority.com/2013/02/10/sql-server-primary-key-and-nonclustered-index-in-simple-words/#comment-420188</link>
		<dc:creator><![CDATA[Arunraja (Rocket)]]></dc:creator>
		<pubDate>Sun, 10 Feb 2013 07:05:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22650#comment-420188</guid>
		<description><![CDATA[Hi Pinal,

Let me add some points.

The clustered index will store the value in the leaf node and its corresponding data columns in the same data page.

Ex: 

My Employee id is 0087 and it is Clustered index column. Whenever I search the table with employee id, it will easily get all my information like name,Date of joining etc.... because they all stored in the same row of the employee id in the table as so the data page since it is clustered.

NON-Clustered Index.

If you have assigned a column as Non-clustered index. The column values were randomly split in the data pages and thus searching will be little slower compare to the clustered index which has every column in assigned to it in a same data page.

Ex:

If we assign the column &#039;Code&#039; as non-clustered index in a dummy table. Consider we have more than 5000 values with code  &#039;500&#039;. They will split them into different data pages. So if you search using &#039;where code=&#039;500&#039;&#039;. The search will finds them in all of the data pages and its remaining column results, because the page reads will be for every data pages.

For the above example say if the column &#039;Code&#039; is clustered  index in a dummy table. The values will stored in the data pages in same order and it will store all the &#039;code&#039; column values within few data pages, so the page reads will be minimal and thus the data retrieval will be quicker as comparing to the non-clustered index.


So it is not a must to add Primary key as clustered.

Thanks,
AR]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Let me add some points.</p>
<p>The clustered index will store the value in the leaf node and its corresponding data columns in the same data page.</p>
<p>Ex: </p>
<p>My Employee id is 0087 and it is Clustered index column. Whenever I search the table with employee id, it will easily get all my information like name,Date of joining etc&#8230;. because they all stored in the same row of the employee id in the table as so the data page since it is clustered.</p>
<p>NON-Clustered Index.</p>
<p>If you have assigned a column as Non-clustered index. The column values were randomly split in the data pages and thus searching will be little slower compare to the clustered index which has every column in assigned to it in a same data page.</p>
<p>Ex:</p>
<p>If we assign the column &#8216;Code&#8217; as non-clustered index in a dummy table. Consider we have more than 5000 values with code  &#8217;500&#8242;. They will split them into different data pages. So if you search using &#8216;where code=&#8217;500&#8221;. The search will finds them in all of the data pages and its remaining column results, because the page reads will be for every data pages.</p>
<p>For the above example say if the column &#8216;Code&#8217; is clustered  index in a dummy table. The values will stored in the data pages in same order and it will store all the &#8216;code&#8217; column values within few data pages, so the page reads will be minimal and thus the data retrieval will be quicker as comparing to the non-clustered index.</p>
<p>So it is not a must to add Primary key as clustered.</p>
<p>Thanks,<br />
AR</p>
]]></content:encoded>
	</item>
</channel>
</rss>
