<?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; Size of Index Table for Each Index &#8211; Solution 2</title>
	<atom:link href="http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #028 &#124; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-472982</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #028 &#124; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 11 May 2013 01:31:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-472982</guid>
		<description><![CDATA[[&#8230;] Size of Index Table for Each Index – Solution 2 Another blog post where I explain how to find size of index using T-SQL script. [&#8230;]]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] Size of Index Table for Each Index – Solution 2 Another blog post where I explain how to find size of index using T-SQL script. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #004 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-379685</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #004 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 24 Nov 2012 01:31:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-379685</guid>
		<description><![CDATA[[...] 1 &#124; Solution 2 &#124; Solution [...]]]></description>
		<content:encoded><![CDATA[<p>[...] 1 | Solution 2 | Solution [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Girijesh Pandey</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-355089</link>
		<dc:creator><![CDATA[Girijesh Pandey]]></dc:creator>
		<pubDate>Tue, 02 Oct 2012 07:38:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-355089</guid>
		<description><![CDATA[Hi Pinal,

Thanks for this excellent post!
i read it completely, found simply great.

A big Thanks to Laerte Junior also, he added nice inputs!

We can also get the details regarding Index by system stored procedure.

sp_estimate_data_compression_savings 
      [ @schema_name = ] &#039;schema_name&#039;  
     , [ @object_name = ] &#039;object_name&#039; 
    , [@index_id = ] index_id 
     , [@partition_number = ] partition_number 
    , [@data_compression = ] &#039;data_compression&#039; 
[;]

Example:-
sp_estimate_data_compression_savings &#039;dbo&#039;, &#039;dep&#039;, NULL, NULL, &#039;row&#039;
Go
sp_estimate_data_compression_savings &#039;dbo&#039;, &#039;emp&#039;, NULL, NULL, &#039;row&#039;


Note:
1.Compression and sp_estimate_data_compression_savings are available only in the SQL Server 2008 Enterprise and Developer editions.		

2. If the existing data is fragmented, you might be able to reduce its size without using compression by rebuilding the index. For indexes, the fill factor will be applied during an index rebuild. This could increase the size of the index.

Regards,
Girijesh]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Thanks for this excellent post!<br />
i read it completely, found simply great.</p>
<p>A big Thanks to Laerte Junior also, he added nice inputs!</p>
<p>We can also get the details regarding Index by system stored procedure.</p>
<p>sp_estimate_data_compression_savings<br />
      [ @schema_name = ] &#8216;schema_name&#8217;<br />
     , [ @object_name = ] &#8216;object_name&#8217;<br />
    , [@index_id = ] index_id<br />
     , [@partition_number = ] partition_number<br />
    , [@data_compression = ] &#8216;data_compression&#8217;<br />
[;]</p>
<p>Example:-<br />
sp_estimate_data_compression_savings &#8216;dbo&#8217;, &#8216;dep&#8217;, NULL, NULL, &#8216;row&#8217;<br />
Go<br />
sp_estimate_data_compression_savings &#8216;dbo&#8217;, &#8216;emp&#8217;, NULL, NULL, &#8216;row&#8217;</p>
<p>Note:<br />
1.Compression and sp_estimate_data_compression_savings are available only in the SQL Server 2008 Enterprise and Developer editions.		</p>
<p>2. If the existing data is fragmented, you might be able to reduce its size without using compression by rebuilding the index. For indexes, the fill factor will be applied during an index rebuild. This could increase the size of the index.</p>
<p>Regards,<br />
Girijesh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick West</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-254929</link>
		<dc:creator><![CDATA[Nick West]]></dc:creator>
		<pubDate>Tue, 21 Feb 2012 17:49:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-254929</guid>
		<description><![CDATA[Create a temp table, use msforeachtable to query the indicies on each table and save the results back to your temp table.

CREATE TABLE #indexSizes(ID int, Name nvarchar(4000), SizeInKB int, Comments nvarchar(4000)) 
exec sp_MSforeachtable &#039;insert into #indexSizes(ID, Name, SizeInKB, Comments) exec sp_MSIndexSpace &#039;&#039;?&#039;&#039; &#039;
select * from #indexSizes
drop table #indexSizes]]></description>
		<content:encoded><![CDATA[<p>Create a temp table, use msforeachtable to query the indicies on each table and save the results back to your temp table.</p>
<p>CREATE TABLE #indexSizes(ID int, Name nvarchar(4000), SizeInKB int, Comments nvarchar(4000))<br />
exec sp_MSforeachtable &#8216;insert into #indexSizes(ID, Name, SizeInKB, Comments) exec sp_MSIndexSpace &#8221;?&#8221; &#8216;<br />
select * from #indexSizes<br />
drop table #indexSizes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Difference between Create Index &#8211; Drop Index &#8211; Rebuild Index &#8211; Quiz &#8211; Puzzle &#8211; 21 of 31 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-242015</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Difference between Create Index &#8211; Drop Index &#8211; Rebuild Index &#8211; Quiz &#8211; Puzzle &#8211; 21 of 31 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sun, 22 Jan 2012 01:31:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-242015</guid>
		<description><![CDATA[[...] and B-Tree Index Levels, Page Count, Record Count and DMV &#8211; sys.dm_db_index_physical_stats Size of Index Table for Each Index – Solution 2 Computed Columns – Index and Performance Index Created on View not Used Often – Limitation of [...]]]></description>
		<content:encoded><![CDATA[<p>[...] and B-Tree Index Levels, Page Count, Record Count and DMV &#8211; sys.dm_db_index_physical_stats Size of Index Table for Each Index – Solution 2 Computed Columns – Index and Performance Index Created on View not Used Often – Limitation of [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DBA100</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-139980</link>
		<dc:creator><![CDATA[DBA100]]></dc:creator>
		<pubDate>Thu, 09 Jun 2011 09:27:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-139980</guid>
		<description><![CDATA[by running 
&quot;SELECT
 OBJECT_NAME(i.OBJECT_ID) AS TableName,
 i.name AS IndexName,
 i.index_id AS IndexID,
 8 * SUM(a.used_pages) AS &#039;Indexsize(KB)&#039;
 FROM sys.indexes AS i
 JOIN sys.partitions AS p ON p.OBJECT_ID = i.OBJECT_ID AND p.index_id = i.index_id
 JOIN sys.allocation_units AS a ON a.container_id = p.partition_id
 GROUP BY i.OBJECT_ID,i.index_id,i.name
 ORDER BY OBJECT_NAME(i.OBJECT_ID),i.index_id&quot;

Why some indexname are null ?]]></description>
		<content:encoded><![CDATA[<p>by running<br />
&#8220;SELECT<br />
 OBJECT_NAME(i.OBJECT_ID) AS TableName,<br />
 i.name AS IndexName,<br />
 i.index_id AS IndexID,<br />
 8 * SUM(a.used_pages) AS &#8216;Indexsize(KB)&#8217;<br />
 FROM sys.indexes AS i<br />
 JOIN sys.partitions AS p ON p.OBJECT_ID = i.OBJECT_ID AND p.index_id = i.index_id<br />
 JOIN sys.allocation_units AS a ON a.container_id = p.partition_id<br />
 GROUP BY i.OBJECT_ID,i.index_id,i.name<br />
 ORDER BY OBJECT_NAME(i.OBJECT_ID),i.index_id&#8221;</p>
<p>Why some indexname are null ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shaikferozbasha</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-127031</link>
		<dc:creator><![CDATA[shaikferozbasha]]></dc:creator>
		<pubDate>Wed, 06 Apr 2011 13:19:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-127031</guid>
		<description><![CDATA[hello plz help to get nonclustered index size without any data occupied i mean wat the above queries giving size of each nonclustered index size with data in the columns but i need query to find nonclustered size without any data added in the columns then the size comes within bytes not kb]]></description>
		<content:encoded><![CDATA[<p>hello plz help to get nonclustered index size without any data occupied i mean wat the above queries giving size of each nonclustered index size with data in the columns but i need query to find nonclustered size without any data added in the columns then the size comes within bytes not kb</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rohit Sharma</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-118739</link>
		<dc:creator><![CDATA[Rohit Sharma]]></dc:creator>
		<pubDate>Tue, 15 Feb 2011 22:52:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-118739</guid>
		<description><![CDATA[We can use sp_estimate_data_compression_savings to know the size of each index. 

Thanks
Rohit]]></description>
		<content:encoded><![CDATA[<p>We can use sp_estimate_data_compression_savings to know the size of each index. </p>
<p>Thanks<br />
Rohit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamesh shah</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-106225</link>
		<dc:creator><![CDATA[Kamesh shah]]></dc:creator>
		<pubDate>Fri, 17 Dec 2010 05:18:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-106225</guid>
		<description><![CDATA[Thnx sir

its very much clear now about index sizes.


THANKS AND REGARDS 
Kamesh Shah]]></description>
		<content:encoded><![CDATA[<p>Thnx sir</p>
<p>its very much clear now about index sizes.</p>
<p>THANKS AND REGARDS<br />
Kamesh Shah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-106222</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Fri, 17 Dec 2010 04:56:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-106222</guid>
		<description><![CDATA[clustered index is table itself.]]></description>
		<content:encoded><![CDATA[<p>clustered index is table itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-106220</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Fri, 17 Dec 2010 04:11:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-106220</guid>
		<description><![CDATA[If you are using clustered index the size of the index will be the size of the table itself. 

Please check your index if that is clustered.]]></description>
		<content:encoded><![CDATA[<p>If you are using clustered index the size of the index will be the size of the table itself. </p>
<p>Please check your index if that is clustered.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamesh shah</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-106218</link>
		<dc:creator><![CDATA[Kamesh shah]]></dc:creator>
		<pubDate>Fri, 17 Dec 2010 04:07:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-106218</guid>
		<description><![CDATA[hi Sir,

It is now giving absolute correct result.i made that index non clustered and now perfect result.

Amazing hands on SQL SERVER Sir.HATS OFF to you..

i have drawn conclusion that if there is a clustered index then size of index would be displayed index size + table size 

but if the index is non clustered then size of index will be separate from table size and

sir note that not even a single insert of mine is overflowing the page size that is 8060 bytes so would be in a single partition and no furhter allocation.

but why sizes are consolidated and separated ?? see as far as i know then it has to do something with mix and uniform extents or else concept is there??

My second perception on this is (just what i know)
--&gt; Clustered index consist a data rows in a leaf node thats why its size is consolidated with table size

--&gt; non cluster index contains a row locator at leaf node thats why index structure is totally separated from  table data structure 

my question is like why clustered index size is calculated like=table size+index size
and non clustered is like only table size different and index size different???

THANKS AND REGARDS
Kamesh Shah]]></description>
		<content:encoded><![CDATA[<p>hi Sir,</p>
<p>It is now giving absolute correct result.i made that index non clustered and now perfect result.</p>
<p>Amazing hands on SQL SERVER Sir.HATS OFF to you..</p>
<p>i have drawn conclusion that if there is a clustered index then size of index would be displayed index size + table size </p>
<p>but if the index is non clustered then size of index will be separate from table size and</p>
<p>sir note that not even a single insert of mine is overflowing the page size that is 8060 bytes so would be in a single partition and no furhter allocation.</p>
<p>but why sizes are consolidated and separated ?? see as far as i know then it has to do something with mix and uniform extents or else concept is there??</p>
<p>My second perception on this is (just what i know)<br />
&#8211;&gt; Clustered index consist a data rows in a leaf node thats why its size is consolidated with table size</p>
<p>&#8211;&gt; non cluster index contains a row locator at leaf node thats why index structure is totally separated from  table data structure </p>
<p>my question is like why clustered index size is calculated like=table size+index size<br />
and non clustered is like only table size different and index size different???</p>
<p>THANKS AND REGARDS<br />
Kamesh Shah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamesh shah</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-106106</link>
		<dc:creator><![CDATA[Kamesh shah]]></dc:creator>
		<pubDate>Thu, 16 Dec 2010 13:27:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-106106</guid>
		<description><![CDATA[i have send you snaps in email

THANKS and REGARDS
Kamesh Shah]]></description>
		<content:encoded><![CDATA[<p>i have send you snaps in email</p>
<p>THANKS and REGARDS<br />
Kamesh Shah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamesh shah</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-106103</link>
		<dc:creator><![CDATA[Kamesh shah]]></dc:creator>
		<pubDate>Thu, 16 Dec 2010 13:14:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-106103</guid>
		<description><![CDATA[Hi Pinal,

I used
SELECT
OBJECT_NAME(i.OBJECT_ID) AS TableName,
i.name AS IndexName,
i.index_id AS IndexID,
8 * SUM(a.used_pages) AS &#039;Indexsize(KB)&#039;
FROM sys.indexes AS i
JOIN sys.partitions AS p ON p.OBJECT_ID = i.OBJECT_ID AND p.index_id = i.index_id
JOIN sys.allocation_units AS a ON a.container_id = p.partition_id
GROUP BY i.OBJECT_ID,i.index_id,i.name
ORDER BY OBJECT_NAME(i.OBJECT_ID),i.index_id


this your query to get the index size which is giving 20496 KB 

for the same m trying now  sp_spaceused SP again to get the index size then for total database it is giving me 808KB There is a vast difference.

AND one more thing
 this size which from this query we are getting is calculated for data pages which stores data not which stores index 
i want seperate index size which not includes data.
i made a crosscheck and that time i used query

EXEC sp_MSforeachtable @command1=&quot;EXEC sp_spaceused &#039;?&#039;&quot;


used query is giving me a table size 20336 KB and index size for that table 160 KB

in a nutshell,

from ur query i m getting index size 20496 KB and from sp_spaceused i  m getting index for that atble 160 KB

If you wish i can send you the snaps for that in ur email.

and dont mind if directly or indirectly i had written something not properly as i had only 6 months experience i m fresher 

THANKS and REGARDS
Kamesh Shah]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I used<br />
SELECT<br />
OBJECT_NAME(i.OBJECT_ID) AS TableName,<br />
i.name AS IndexName,<br />
i.index_id AS IndexID,<br />
8 * SUM(a.used_pages) AS &#8216;Indexsize(KB)&#8217;<br />
FROM sys.indexes AS i<br />
JOIN sys.partitions AS p ON p.OBJECT_ID = i.OBJECT_ID AND p.index_id = i.index_id<br />
JOIN sys.allocation_units AS a ON a.container_id = p.partition_id<br />
GROUP BY i.OBJECT_ID,i.index_id,i.name<br />
ORDER BY OBJECT_NAME(i.OBJECT_ID),i.index_id</p>
<p>this your query to get the index size which is giving 20496 KB </p>
<p>for the same m trying now  sp_spaceused SP again to get the index size then for total database it is giving me 808KB There is a vast difference.</p>
<p>AND one more thing<br />
 this size which from this query we are getting is calculated for data pages which stores data not which stores index<br />
i want seperate index size which not includes data.<br />
i made a crosscheck and that time i used query</p>
<p>EXEC sp_MSforeachtable @command1=&#8221;EXEC sp_spaceused &#8216;?&#8217;&#8221;</p>
<p>used query is giving me a table size 20336 KB and index size for that table 160 KB</p>
<p>in a nutshell,</p>
<p>from ur query i m getting index size 20496 KB and from sp_spaceused i  m getting index for that atble 160 KB</p>
<p>If you wish i can send you the snaps for that in ur email.</p>
<p>and dont mind if directly or indirectly i had written something not properly as i had only 6 months experience i m fresher </p>
<p>THANKS and REGARDS<br />
Kamesh Shah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQLAuthority News – Monthly Roundup of Best SQL Posts Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-73940</link>
		<dc:creator><![CDATA[SQLAuthority News – Monthly Roundup of Best SQL Posts Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Mon, 31 May 2010 01:32:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-73940</guid>
		<description><![CDATA[[...] SQL SERVER – Size of Index Table for Each Index – Solution 2 SQL SERVER – Size of Index Table for Each Index – Solution 3 – Powershell SQL SERVER – Four Posts on Removing the Bookmark Lookup – Key Lookup [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – Size of Index Table for Each Index – Solution 2 SQL SERVER – Size of Index Table for Each Index – Solution 3 – Powershell SQL SERVER – Four Posts on Removing the Bookmark Lookup – Key Lookup [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Size of Index Table for Each Index – Solution 3 – Powershell Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-69983</link>
		<dc:creator><![CDATA[SQL SERVER – Size of Index Table for Each Index – Solution 3 – Powershell Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Mon, 10 May 2010 01:31:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-69983</guid>
		<description><![CDATA[[...] I was not able to get going with this tool. Finally, yesterday I sent email to Laerte in response to his comment posted here. Within 5 minutes, Laerte came online and helped me with the solution. He spend nearly 15 minutes [...]]]></description>
		<content:encoded><![CDATA[<p>[...] I was not able to get going with this tool. Finally, yesterday I sent email to Laerte in response to his comment posted here. Within 5 minutes, Laerte came online and helped me with the solution. He spend nearly 15 minutes [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Carter</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-69916</link>
		<dc:creator><![CDATA[Jeremy Carter]]></dc:creator>
		<pubDate>Sun, 09 May 2010 17:18:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-69916</guid>
		<description><![CDATA[Pinal,

Here is one I wrote.  This one gives the filegroup the object belongs to and filters out system objects. 

SELECT
fg.name as FileGroup,
obj.name as table_name,
ISNULL(ind.name,&#039;&#039;) as index_name,
ind.type_desc,
used_page_count,
used_page_count/128 AS used_page_size_MB,
reserved_page_count,
reserved_page_count/128 AS reserved_page_size_MB
FROM sys.dm_db_partition_stats AS ps
INNER JOIN sys.indexes AS ind 
	ON ps.object_id = ind.object_id
	and ps.index_id = ind.index_id
INNER JOIN sys.objects as obj
	ON ind.object_id=obj.object_id
INNER JOIN sys.filegroups as fg
	ON fg.data_space_id=ind.data_space_id
WHERE obj.type&#039;S&#039;
ORDER BY obj.name, ind.name

Thanks,
Jeremy]]></description>
		<content:encoded><![CDATA[<p>Pinal,</p>
<p>Here is one I wrote.  This one gives the filegroup the object belongs to and filters out system objects. </p>
<p>SELECT<br />
fg.name as FileGroup,<br />
obj.name as table_name,<br />
ISNULL(ind.name,&#8221;) as index_name,<br />
ind.type_desc,<br />
used_page_count,<br />
used_page_count/128 AS used_page_size_MB,<br />
reserved_page_count,<br />
reserved_page_count/128 AS reserved_page_size_MB<br />
FROM sys.dm_db_partition_stats AS ps<br />
INNER JOIN sys.indexes AS ind<br />
	ON ps.object_id = ind.object_id<br />
	and ps.index_id = ind.index_id<br />
INNER JOIN sys.objects as obj<br />
	ON ind.object_id=obj.object_id<br />
INNER JOIN sys.filegroups as fg<br />
	ON fg.data_space_id=ind.data_space_id<br />
WHERE obj.type&#8217;S&#8217;<br />
ORDER BY obj.name, ind.name</p>
<p>Thanks,<br />
Jeremy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-69843</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Sun, 09 May 2010 04:19:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-69843</guid>
		<description><![CDATA[Hi Laerte Junior,

This is excellent comment! I really like it.

Kind Regards,
Pinal]]></description>
		<content:encoded><![CDATA[<p>Hi Laerte Junior,</p>
<p>This is excellent comment! I really like it.</p>
<p>Kind Regards,<br />
Pinal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laerte Junior</title>
		<link>http://blog.sqlauthority.com/2010/05/09/sql-server-size-of-index-table-for-each-index-solution-2/#comment-69836</link>
		<dc:creator><![CDATA[Laerte Junior]]></dc:creator>
		<pubDate>Sun, 09 May 2010 02:23:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8901#comment-69836</guid>
		<description><![CDATA[Hi Pinal,

I do not say better, but maybe another approach to enthusiasts in powershell and SQLSPX library would be:

1 - All indexes in all tables and all databases 
Get-SqlDatabase -sqlserver &quot;Yourserver&quot;  &#124; Get-SqlTable &#124; Get-SqlIndex &#124; Format-table Server,dbname,schema,table,name,id,spaceused

2 - All Indexes in all tables and especific database
Get-SqlDatabase -sqlserver &quot;Yourserver&quot;  &quot;Yourdb&quot; &#124; Get-SqlTable &#124; Get-SqlIndex &#124; Format-table Server,dbname,schema,table,name,id,spaceused

3 - All Indexes in especific table and database
Get-SqlDatabase -sqlserver &quot;Yourserver&quot;  &quot;Yourdb&quot; &#124; Get-SqlTable &quot;YourTable&quot; &#124; Get-SqlIndex &#124; Format-table Server,dbname,schema,table,name,id,spaceused

and to output to txt.. pipe Out-File

Get-SqlDatabase -sqlserver &quot;Yourserver&quot;  &#124; Get-SqlTable &#124; Get-SqlIndex &#124; Format-table Server,dbname,schema,table,name,id,spaceused &#124; out-file c:\IndexesSize.txt

If you have one txt with all your servers, can be for all of them also. 

Lets say  you have all your servers in servers.txt: something like
NameServer1
NameServer2
NameServer3
NameServer4

We could Use :
foreach ($Server in Get-content c:\temp\servers.txt) {
Get-SqlDatabase -sqlserver $Server  &#124; Get-SqlTable &#124; Get-SqlIndex &#124; Format-table Server,dbname,schema,table,name,id,spaceused
}

:)]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I do not say better, but maybe another approach to enthusiasts in powershell and SQLSPX library would be:</p>
<p>1 &#8211; All indexes in all tables and all databases<br />
Get-SqlDatabase -sqlserver &#8220;Yourserver&#8221;  | Get-SqlTable | Get-SqlIndex | Format-table Server,dbname,schema,table,name,id,spaceused</p>
<p>2 &#8211; All Indexes in all tables and especific database<br />
Get-SqlDatabase -sqlserver &#8220;Yourserver&#8221;  &#8220;Yourdb&#8221; | Get-SqlTable | Get-SqlIndex | Format-table Server,dbname,schema,table,name,id,spaceused</p>
<p>3 &#8211; All Indexes in especific table and database<br />
Get-SqlDatabase -sqlserver &#8220;Yourserver&#8221;  &#8220;Yourdb&#8221; | Get-SqlTable &#8220;YourTable&#8221; | Get-SqlIndex | Format-table Server,dbname,schema,table,name,id,spaceused</p>
<p>and to output to txt.. pipe Out-File</p>
<p>Get-SqlDatabase -sqlserver &#8220;Yourserver&#8221;  | Get-SqlTable | Get-SqlIndex | Format-table Server,dbname,schema,table,name,id,spaceused | out-file c:\IndexesSize.txt</p>
<p>If you have one txt with all your servers, can be for all of them also. </p>
<p>Lets say  you have all your servers in servers.txt: something like<br />
NameServer1<br />
NameServer2<br />
NameServer3<br />
NameServer4</p>
<p>We could Use :<br />
foreach ($Server in Get-content c:\temp\servers.txt) {<br />
Get-SqlDatabase -sqlserver $Server  | Get-SqlTable | Get-SqlIndex | Format-table Server,dbname,schema,table,name,id,spaceused<br />
}</p>
<p>:)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
