<?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; 2005 &#8211; Find Index Fragmentation Details &#8211; Slow Index Performance</title>
	<atom:link href="http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 10 Feb 2012 04:45:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Bhagesh,Apple (ctr)</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-239251</link>
		<dc:creator><![CDATA[Bhagesh,Apple (ctr)]]></dc:creator>
		<pubDate>Tue, 17 Jan 2012 09:32:55 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-239251</guid>
		<description><![CDATA[Bhagesh, Apple

There a way to quantify how much query performance will suffer once an index becomes heavily fragmented? I have a client with a 365x24x7 system that suffers from locking/blocking during index optimizations, so they are considering reducing the frequency or doing away with index optimizations altogether for specific indexes. I knew that this is a good idea, so I’d like to be able to quantify the performance impct that would result.]]></description>
		<content:encoded><![CDATA[<p>Bhagesh, Apple</p>
<p>There a way to quantify how much query performance will suffer once an index becomes heavily fragmented? I have a client with a 365x24x7 system that suffers from locking/blocking during index optimizations, so they are considering reducing the frequency or doing away with index optimizations altogether for specific indexes. I knew that this is a good idea, so I’d like to be able to quantify the performance impct that would result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nico</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-208702</link>
		<dc:creator><![CDATA[Nico]]></dc:creator>
		<pubDate>Thu, 01 Dec 2011 15:04:39 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-208702</guid>
		<description><![CDATA[You need to run it against the master database, other databases doesn&#039;t contain the DB_ID() function select DB_ID(N&#039;MyDataBaseName&#039;) will return the database id.]]></description>
		<content:encoded><![CDATA[<p>You need to run it against the master database, other databases doesn&#8217;t contain the DB_ID() function select DB_ID(N&#8217;MyDataBaseName&#8217;) will return the database id.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prumery</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-172524</link>
		<dc:creator><![CDATA[prumery]]></dc:creator>
		<pubDate>Tue, 27 Sep 2011 13:52:10 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-172524</guid>
		<description><![CDATA[this will loop thru all tables that have a frag% &gt; 40 and also puts the schema in front of the table name.

 create table #frag(
 tabName varchar(200)
 )
 insert into #frag 
 select S.name + &#039;.&#039; + tbl.[name] TableName 
 from sys.dm_db_index_physical_stats (null, null, null, null, null )as mn
 inner join sys.tables tbl on tbl.[object_id] = mn.[object_id]
 inner join sys.indexes ind on ind.[object_id] = mn.[object_id]
 inner join sys.schemas S on tbl.schema_id  = S.schema_id  
 where [database_id] = db_id() and mn.avg_fragmentation_in_percent &gt; 40
 order by mn.avg_fragmentation_in_percent desc
  
 while exists(select top 1 tabName from #frag)
 begin
 declare @name as varchar(200), @sql varchar(1000)
	select top 1 @name = tabName from #frag 
	set @sql = &#039;ALTER INDEX ALL ON &#039; + @name + &#039; REBUILD&#039;
	select @sql 
	delete from #frag where tabName = @name 
	exec(@sql)
 end
 
 drop table #frag]]></description>
		<content:encoded><![CDATA[<p>this will loop thru all tables that have a frag% &gt; 40 and also puts the schema in front of the table name.</p>
<p> create table #frag(<br />
 tabName varchar(200)<br />
 )<br />
 insert into #frag<br />
 select S.name + &#8216;.&#8217; + tbl.[name] TableName<br />
 from sys.dm_db_index_physical_stats (null, null, null, null, null )as mn<br />
 inner join sys.tables tbl on tbl.[object_id] = mn.[object_id]<br />
 inner join sys.indexes ind on ind.[object_id] = mn.[object_id]<br />
 inner join sys.schemas S on tbl.schema_id  = S.schema_id<br />
 where [database_id] = db_id() and mn.avg_fragmentation_in_percent &gt; 40<br />
 order by mn.avg_fragmentation_in_percent desc</p>
<p> while exists(select top 1 tabName from #frag)<br />
 begin<br />
 declare @name as varchar(200), @sql varchar(1000)<br />
	select top 1 @name = tabName from #frag<br />
	set @sql = &#8216;ALTER INDEX ALL ON &#8216; + @name + &#8216; REBUILD&#8217;<br />
	select @sql<br />
	delete from #frag where tabName = @name<br />
	exec(@sql)<br />
 end</p>
<p> drop table #frag</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Thacker</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-136203</link>
		<dc:creator><![CDATA[Bill Thacker]]></dc:creator>
		<pubDate>Mon, 23 May 2011 12:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-136203</guid>
		<description><![CDATA[Is there a way to quantify how much query performance can/will suffer once an index becomes heavily fragmented? I have a client with a 365x24x7 system that suffers from locking/blocking during index optimizations, so they are considering reducing the frequency or doing away with index optimizations altogether for specific indexes. I don&#039;t think this is a good idea, so I&#039;d like to be able to quantify the performance impct that would result.]]></description>
		<content:encoded><![CDATA[<p>Is there a way to quantify how much query performance can/will suffer once an index becomes heavily fragmented? I have a client with a 365x24x7 system that suffers from locking/blocking during index optimizations, so they are considering reducing the frequency or doing away with index optimizations altogether for specific indexes. I don&#8217;t think this is a good idea, so I&#8217;d like to be able to quantify the performance impct that would result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rahul</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-131937</link>
		<dc:creator><![CDATA[Rahul]]></dc:creator>
		<pubDate>Fri, 29 Apr 2011 09:26:37 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-131937</guid>
		<description><![CDATA[Hi,

I am using the following query to get my index details to reorgnaize or rebuild them

SELECT 
		OBJECT_NAME(B.OBJECT_ID) as TableName, b.name as Index_Name, 
		CASE 
		WHEN ps.avg_fragmentation_in_percent &gt; 30 THEN &#039;REBUILD WITH (,PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF,ALLOW_ROW_LOCKS=OFF,ALLOW_PAGE_LOCKS=OFF,ONLINE=ON,SORT_IN_TEMPDB = ON,MAXDOP=2)&#039; --FOR ONLINE ADD USE THIS &#039;REBUILD WITH(ONLINE = ON)&#039;
		ELSE &#039;REORGANIZE&#039;  
		END AS INDEX_OPTION,avg_fragmentation_in_percent as Fragmentation_Size,
		ps.Page_count as TotalPage
		FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS ps
		INNER JOIN sys.indexes AS b ON ps.OBJECT_ID = b.OBJECT_ID
		AND ps.index_id = b.index_id
		WHERE ps.database_id = DB_ID() AND b.name IS NOT NULL AND ps.avg_fragmentation_in_percent &gt; 10
		ORDER BY TotalPage desc 




But its making my machine hang, I am unable to do anything after executing this. Could we do some improvement in this query.]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am using the following query to get my index details to reorgnaize or rebuild them</p>
<p>SELECT<br />
		OBJECT_NAME(B.OBJECT_ID) as TableName, b.name as Index_Name,<br />
		CASE<br />
		WHEN ps.avg_fragmentation_in_percent &gt; 30 THEN &#8216;REBUILD WITH (,PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF,ALLOW_ROW_LOCKS=OFF,ALLOW_PAGE_LOCKS=OFF,ONLINE=ON,SORT_IN_TEMPDB = ON,MAXDOP=2)&#8217; &#8211;FOR ONLINE ADD USE THIS &#8216;REBUILD WITH(ONLINE = ON)&#8217;<br />
		ELSE &#8216;REORGANIZE&#8217;<br />
		END AS INDEX_OPTION,avg_fragmentation_in_percent as Fragmentation_Size,<br />
		ps.Page_count as TotalPage<br />
		FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS ps<br />
		INNER JOIN sys.indexes AS b ON ps.OBJECT_ID = b.OBJECT_ID<br />
		AND ps.index_id = b.index_id<br />
		WHERE ps.database_id = DB_ID() AND b.name IS NOT NULL AND ps.avg_fragmentation_in_percent &gt; 10<br />
		ORDER BY TotalPage desc </p>
<p>But its making my machine hang, I am unable to do anything after executing this. Could we do some improvement in this query.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BobsgearDotCom</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-88354</link>
		<dc:creator><![CDATA[BobsgearDotCom]]></dc:creator>
		<pubDate>Sun, 19 Sep 2010 17:13:06 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-88354</guid>
		<description><![CDATA[Warning: On a large table, this command can take a very very long time to run... I have some indexes that are over 1GB in size (2.6M records) and looking at fragmentation on some individual indexes with properties can take more than 30 minutes and require over 3M physical I/O according to activity monitor.]]></description>
		<content:encoded><![CDATA[<p>Warning: On a large table, this command can take a very very long time to run&#8230; I have some indexes that are over 1GB in size (2.6M records) and looking at fragmentation on some individual indexes with properties can take more than 30 minutes and require over 3M physical I/O according to activity monitor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: online</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-65160</link>
		<dc:creator><![CDATA[online]]></dc:creator>
		<pubDate>Wed, 14 Apr 2010 11:12:16 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-65160</guid>
		<description><![CDATA[Hmm... it sure creates a perspective to things...]]></description>
		<content:encoded><![CDATA[<p>Hmm&#8230; it sure creates a perspective to things&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: george Gopie</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-55092</link>
		<dc:creator><![CDATA[george Gopie]]></dc:creator>
		<pubDate>Fri, 21 Aug 2009 13:19:27 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-55092</guid>
		<description><![CDATA[Pinal,

Why the script would not return any indexes and their statistics e.g % fragmented? Doe this mean ther are none indexes in this datbase thar are fragmented even a small percent. DO i need to run something else before i run this script.]]></description>
		<content:encoded><![CDATA[<p>Pinal,</p>
<p>Why the script would not return any indexes and their statistics e.g % fragmented? Doe this mean ther are none indexes in this datbase thar are fragmented even a small percent. DO i need to run something else before i run this script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: willBen</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-52902</link>
		<dc:creator><![CDATA[willBen]]></dc:creator>
		<pubDate>Wed, 10 Jun 2009 11:49:59 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-52902</guid>
		<description><![CDATA[Pinal Dave, you sir, are, a legend.]]></description>
		<content:encoded><![CDATA[<p>Pinal Dave, you sir, are, a legend.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Musab</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-45195</link>
		<dc:creator><![CDATA[Musab]]></dc:creator>
		<pubDate>Tue, 30 Dec 2008 09:38:24 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-45195</guid>
		<description><![CDATA[Try rebuilding the index it will improve it]]></description>
		<content:encoded><![CDATA[<p>Try rebuilding the index it will improve it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AdminByDefault</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-43401</link>
		<dc:creator><![CDATA[AdminByDefault]]></dc:creator>
		<pubDate>Tue, 30 Sep 2008 12:55:29 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-43401</guid>
		<description><![CDATA[I have tried to defrag the tables in my databases but have discovered that some indexes will not improve better than 85% total fragmentation.  How can I overcome this problem? Or is this something that I should not be concerned with?]]></description>
		<content:encoded><![CDATA[<p>I have tried to defrag the tables in my databases but have discovered that some indexes will not improve better than 85% total fragmentation.  How can I overcome this problem? Or is this something that I should not be concerned with?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yusuf</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-41704</link>
		<dc:creator><![CDATA[Yusuf]]></dc:creator>
		<pubDate>Fri, 15 Aug 2008 14:43:10 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-41704</guid>
		<description><![CDATA[Can we merge the following into the output 
1. Indexed Columns
2. Included Columns]]></description>
		<content:encoded><![CDATA[<p>Can we merge the following into the output<br />
1. Indexed Columns<br />
2. Included Columns</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DiegoP</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-38830</link>
		<dc:creator><![CDATA[DiegoP]]></dc:creator>
		<pubDate>Tue, 27 May 2008 16:20:12 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-38830</guid>
		<description><![CDATA[You can replace DB_ID() with the database ID:

You can do this to find out the ID:

USE yourdatabase
SELECT DB_ID() AS [Database ID];
GO]]></description>
		<content:encoded><![CDATA[<p>You can replace DB_ID() with the database ID:</p>
<p>You can do this to find out the ID:</p>
<p>USE yourdatabase<br />
SELECT DB_ID() AS [Database ID];<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PAN</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-38750</link>
		<dc:creator><![CDATA[PAN]]></dc:creator>
		<pubDate>Fri, 23 May 2008 03:46:40 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-38750</guid>
		<description><![CDATA[I tried teh above script but it give sme this error-
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near &#039;(&#039;.

Do I have to replace the exact Database name etc somewhere in this script.]]></description>
		<content:encoded><![CDATA[<p>I tried teh above script but it give sme this error-<br />
Msg 102, Level 15, State 1, Line 4<br />
Incorrect syntax near &#8216;(&#8216;.</p>
<p>Do I have to replace the exact Database name etc somewhere in this script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vince</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-37325</link>
		<dc:creator><![CDATA[Vince]]></dc:creator>
		<pubDate>Thu, 08 May 2008 17:51:02 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-37325</guid>
		<description><![CDATA[This modification of the original will return the Parent table name.
USE [your DB]
GO
SELECT ps.database_id, ps.OBJECT_ID, ps.index_id, si.name, ps.avg_fragmentation_in_percent, 
		(SELECT distinct so.name FROM sys.objects so INNER JOIN sys.indexes ON so.object_id = si.object_id) ParentTable
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS ps
INNER JOIN sys.indexes si ON ps.OBJECT_ID = si.OBJECT_ID
        AND ps.index_id = si.index_id
WHERE ps.database_id = DB_ID() AND si.name is not null AND
ps.avg_fragmentation_in_percent &gt; 30 --- min % to return
ORDER BY ps.avg_fragmentation_in_percent desc
GO]]></description>
		<content:encoded><![CDATA[<p>This modification of the original will return the Parent table name.<br />
USE [your DB]<br />
GO<br />
SELECT ps.database_id, ps.OBJECT_ID, ps.index_id, si.name, ps.avg_fragmentation_in_percent,<br />
		(SELECT distinct so.name FROM sys.objects so INNER JOIN sys.indexes ON so.object_id = si.object_id) ParentTable<br />
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS ps<br />
INNER JOIN sys.indexes si ON ps.OBJECT_ID = si.OBJECT_ID<br />
        AND ps.index_id = si.index_id<br />
WHERE ps.database_id = DB_ID() AND si.name is not null AND<br />
ps.avg_fragmentation_in_percent &gt; 30 &#8212; min % to return<br />
ORDER BY ps.avg_fragmentation_in_percent desc<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mal</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-35052</link>
		<dc:creator><![CDATA[mal]]></dc:creator>
		<pubDate>Mon, 14 Apr 2008 12:00:06 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-35052</guid>
		<description><![CDATA[select	tbl.[name] TableName, 
		ind.[name] IndexName,
		mn.index_type_desc IndexType, 
		mn.avg_fragmentation_in_percent [FRAG_%]
  from sys.dm_db_index_physical_stats (null, null, null, null, null )as mn
inner join sys.tables tbl on tbl.[object_id] = mn.[object_id] 
inner join sys.indexes ind on ind.[object_id] = mn.[object_id]
where [database_id] = db_id(&#039;dbSynthetics&#039;)
order by mn.avg_fragmentation_in_percent desc]]></description>
		<content:encoded><![CDATA[<p>select	tbl.[name] TableName,<br />
		ind.[name] IndexName,<br />
		mn.index_type_desc IndexType,<br />
		mn.avg_fragmentation_in_percent [FRAG_%]<br />
  from sys.dm_db_index_physical_stats (null, null, null, null, null )as mn<br />
inner join sys.tables tbl on tbl.[object_id] = mn.[object_id]<br />
inner join sys.indexes ind on ind.[object_id] = mn.[object_id]<br />
where [database_id] = db_id(&#8216;dbSynthetics&#8217;)<br />
order by mn.avg_fragmentation_in_percent desc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BravehearT1326</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-34925</link>
		<dc:creator><![CDATA[BravehearT1326]]></dc:creator>
		<pubDate>Tue, 08 Apr 2008 14:37:40 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-34925</guid>
		<description><![CDATA[Hi there - any chance of amending the above script to show the actual table name where the index resides.....

Thanks]]></description>
		<content:encoded><![CDATA[<p>Hi there &#8211; any chance of amending the above script to show the actual table name where the index resides&#8230;..</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dirty Noodle</title>
		<link>http://blog.sqlauthority.com/2008/03/27/sql-server-2005-find-index-fragmentation-details-slow-index-performance/#comment-34730</link>
		<dc:creator><![CDATA[Dirty Noodle]]></dc:creator>
		<pubDate>Mon, 31 Mar 2008 15:44:08 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=549#comment-34730</guid>
		<description><![CDATA[Can you write the sample script in SQL 2000?  Thanks!]]></description>
		<content:encoded><![CDATA[<p>Can you write the sample script in SQL 2000?  Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

