<?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; Index Levels and Delete Operations &#8211; Page Level Observation</title>
	<atom:link href="http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Wed, 22 May 2013 19:03:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Avani</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-422144</link>
		<dc:creator><![CDATA[Avani]]></dc:creator>
		<pubDate>Fri, 15 Feb 2013 13:50:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-422144</guid>
		<description><![CDATA[Hello Pinal,

How can i delete 3rd row of my table which is having only 1 column and all 5 records have same value?

Ex. Table-T1

Id
-------
2
2
2
2
2

Thanks

Avani]]></description>
		<content:encoded><![CDATA[<p>Hello Pinal,</p>
<p>How can i delete 3rd row of my table which is having only 1 column and all 5 records have same value?</p>
<p>Ex. Table-T1</p>
<p>Id<br />
&#8212;&#8212;-<br />
2<br />
2<br />
2<br />
2<br />
2</p>
<p>Thanks</p>
<p>Avani</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Identify Most Resource Intensive Queries &#8211; SQL in Sixty Seconds #029 &#8211; Video &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-358103</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Identify Most Resource Intensive Queries &#8211; SQL in Sixty Seconds #029 &#8211; Video &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Wed, 10 Oct 2012 01:32:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-358103</guid>
		<description><![CDATA[[...] Index Levels and Delete Operations – Page Level Observation [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Index Levels and Delete Operations – Page Level Observation [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Venakt</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-240688</link>
		<dc:creator><![CDATA[Venakt]]></dc:creator>
		<pubDate>Thu, 19 Jan 2012 10:15:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-240688</guid>
		<description><![CDATA[WHen you use delete the rows actually not deleted but marked as GHOST records, which will finally deleted by dedicated process named GHOST CLEANUP which works relatively slow in background

To force deletion of ghost records run:


DBCC FORCEGHOSTCLEANUP]]></description>
		<content:encoded><![CDATA[<p>WHen you use delete the rows actually not deleted but marked as GHOST records, which will finally deleted by dedicated process named GHOST CLEANUP which works relatively slow in background</p>
<p>To force deletion of ghost records run:</p>
<p>DBCC FORCEGHOSTCLEANUP</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryno1234</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-234967</link>
		<dc:creator><![CDATA[Ryno1234]]></dc:creator>
		<pubDate>Tue, 10 Jan 2012 21:50:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-234967</guid>
		<description><![CDATA[Thank you very much Pinal for this informative post.

Perhaps you can explain / clarify a somewhat similar scenario regarding variable length columns. 

When changing / deleting a column with a LOB data type (text, ntext, xml, etc), the space used is not deallocated. It is not even deallocated over time. A DBCC CLEANTABLE(&#039;DBName&#039;, &#039;TableName&#039;) will update the information displayed in sys.dm_db_index_physical_stats and now recognize that clustered index as having unused space, however this seems like a major flaw within SQL Server.  I regard the developers and engineers whom build such an amazing technology as &#039;brilliant&#039;, so I must believe there is a good reason for this behavior. 

I may also be missing some important details on this, so any clarification on this would be appreciated!

Thanks so much for all your hard work and great information you provide the community.

Ryan]]></description>
		<content:encoded><![CDATA[<p>Thank you very much Pinal for this informative post.</p>
<p>Perhaps you can explain / clarify a somewhat similar scenario regarding variable length columns. </p>
<p>When changing / deleting a column with a LOB data type (text, ntext, xml, etc), the space used is not deallocated. It is not even deallocated over time. A DBCC CLEANTABLE(&#8216;DBName&#8217;, &#8216;TableName&#8217;) will update the information displayed in sys.dm_db_index_physical_stats and now recognize that clustered index as having unused space, however this seems like a major flaw within SQL Server.  I regard the developers and engineers whom build such an amazing technology as &#8216;brilliant&#8217;, so I must believe there is a good reason for this behavior. </p>
<p>I may also be missing some important details on this, so any clarification on this would be appreciated!</p>
<p>Thanks so much for all your hard work and great information you provide the community.</p>
<p>Ryan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Data Warehouseing Concepts – Day 20 of 31 Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-149471</link>
		<dc:creator><![CDATA[SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Data Warehouseing Concepts – Day 20 of 31 Journey to SQLAuthority]]></dc:creator>
		<pubDate>Wed, 20 Jul 2011 01:31:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-149471</guid>
		<description><![CDATA[[...] When data are deleted from any table, the SQL Server does not reduce the size of the table right away; however, it marks those pages as free pages, showing that they belong to the table. When new data are inserted, they are put into those pages first. Once those pages are filled up, SQL Server will allocate new pages. If you wait for sometime, the background process de-allocates the pages, finally reducing the page size. (Read more here) [...]]]></description>
		<content:encoded><![CDATA[<p>[...] When data are deleted from any table, the SQL Server does not reduce the size of the table right away; however, it marks those pages as free pages, showing that they belong to the table. When new data are inserted, they are put into those pages first. Once those pages are filled up, SQL Server will allocate new pages. If you wait for sometime, the background process de-allocates the pages, finally reducing the page size. (Read more here) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: reshma</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-93211</link>
		<dc:creator><![CDATA[reshma]]></dc:creator>
		<pubDate>Fri, 15 Oct 2010 10:53:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-93211</guid>
		<description><![CDATA[I had deleted almost 200 tables,which was having huge data,
But could not bale to see any difference in the Size.
Can u please help me how can i reduce the size of the Database.]]></description>
		<content:encoded><![CDATA[<p>I had deleted almost 200 tables,which was having huge data,<br />
But could not bale to see any difference in the Size.<br />
Can u please help me how can i reduce the size of the Database.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: reshma</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-93210</link>
		<dc:creator><![CDATA[reshma]]></dc:creator>
		<pubDate>Fri, 15 Oct 2010 10:51:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-93210</guid>
		<description><![CDATA[Hi,

Can u please help me,how to deallocate the space used by the tavles which had been deleted.]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Can u please help me,how to deallocate the space used by the tavles which had been deleted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-86945</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Tue, 07 Sep 2010 17:17:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-86945</guid>
		<description><![CDATA[Hi Hrvoje,

You are absolutely correct and based on your feedback, I have modified this blog post.

Many thanks again for taking time and providing accurate feedback.

Kind Regards,
Pinal]]></description>
		<content:encoded><![CDATA[<p>Hi Hrvoje,</p>
<p>You are absolutely correct and based on your feedback, I have modified this blog post.</p>
<p>Many thanks again for taking time and providing accurate feedback.</p>
<p>Kind Regards,<br />
Pinal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-86943</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Tue, 07 Sep 2010 16:57:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-86943</guid>
		<description><![CDATA[Hi,

I have ran this example on SQL Server 2008 R2 and got the results.

I will now run this again with some extensive wait time and will post the results.

Thank you again for writing on this blog.

If this is wrong I will correct it with proper credit to you.

Kind Regards,
Pinal]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have ran this example on SQL Server 2008 R2 and got the results.</p>
<p>I will now run this again with some extensive wait time and will post the results.</p>
<p>Thank you again for writing on this blog.</p>
<p>If this is wrong I will correct it with proper credit to you.</p>
<p>Kind Regards,<br />
Pinal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hrvoje Piasevoli</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-86941</link>
		<dc:creator><![CDATA[Hrvoje Piasevoli]]></dc:creator>
		<pubDate>Tue, 07 Sep 2010 16:51:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-86941</guid>
		<description><![CDATA[I&#039;m sorry but this is just wrong. Both the conclusion and the example. The behavior differs for Heaps and tables with a clustered index. (The following applies to SQL Server 2008 SP1 and it might differ on other versions)

Heaps:
BOL: &quot;When rows are deleted from a heap the Database Engine may use row or page locking for the operation. As a result, the pages made empty by the delete operation remain allocated to the heap. When empty pages are not deallocated, the associated space cannot be reused by other objects in the database.&quot; 
While it may appear that the pages are not deallocated due to you example set size, try increasing the number of inserted rows and you will see that the table size gets reduced to around 25MB. The number of index pages reduces accordingly. (Levels do not apply to heaps)
If on the other hand you put a TABLOCK hint in the delete statement all pages will get deallocated.

Tables with a Clustered Index:
Deleting from a table with a clustered index will deallocate deleted pages regardless of the TABLOCK hint. The difference is that without the hint it will happen by a background clean up process and therefore might not be visible immediately after the delete. Try waiting for a few seconds and check space used. TABLOCK will make this operation synchronous.
Number index levels are kept the same, BUT the size of ALL levels gets reduced and not just the leaf levels. 

Reducing the size of the heap or the levels of indexes in the B-Tree can be achieved in several ways: if the table is empty (and other constraints satisfied) TRUNCATE TABLE will do the work. Other methods are rebuilding the table/clustered index.

Regards,

Hrvoje Piasevoli
@HrvojePiasevoli]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m sorry but this is just wrong. Both the conclusion and the example. The behavior differs for Heaps and tables with a clustered index. (The following applies to SQL Server 2008 SP1 and it might differ on other versions)</p>
<p>Heaps:<br />
BOL: &#8220;When rows are deleted from a heap the Database Engine may use row or page locking for the operation. As a result, the pages made empty by the delete operation remain allocated to the heap. When empty pages are not deallocated, the associated space cannot be reused by other objects in the database.&#8221;<br />
While it may appear that the pages are not deallocated due to you example set size, try increasing the number of inserted rows and you will see that the table size gets reduced to around 25MB. The number of index pages reduces accordingly. (Levels do not apply to heaps)<br />
If on the other hand you put a TABLOCK hint in the delete statement all pages will get deallocated.</p>
<p>Tables with a Clustered Index:<br />
Deleting from a table with a clustered index will deallocate deleted pages regardless of the TABLOCK hint. The difference is that without the hint it will happen by a background clean up process and therefore might not be visible immediately after the delete. Try waiting for a few seconds and check space used. TABLOCK will make this operation synchronous.<br />
Number index levels are kept the same, BUT the size of ALL levels gets reduced and not just the leaf levels. </p>
<p>Reducing the size of the heap or the levels of indexes in the B-Tree can be achieved in several ways: if the table is empty (and other constraints satisfied) TRUNCATE TABLE will do the work. Other methods are rebuilding the table/clustered index.</p>
<p>Regards,</p>
<p>Hrvoje Piasevoli<br />
@HrvojePiasevoli</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sumit Kumar Gaud</title>
		<link>http://blog.sqlauthority.com/2010/09/07/sql-server-index-levels-and-delete-operations-page-level-observation/#comment-86839</link>
		<dc:creator><![CDATA[Sumit Kumar Gaud]]></dc:creator>
		<pubDate>Tue, 07 Sep 2010 05:55:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10131#comment-86839</guid>
		<description><![CDATA[How to reduce the size of table after deleting the records?]]></description>
		<content:encoded><![CDATA[<p>How to reduce the size of table after deleting the records?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
