How do I find all the tables and indexes that are partitioned?

Published 17 July 07 02:42 AM | SQL Master 

If you have a huge number of partitioned tables and indexes then the following query would help you to identify the list of objects that are involved.

USE <database_name>;
GO
SELECT SCHEMA_NAME(o.schema_id) AS schema_name
    ,OBJECT_NAME(p.object_id) AS table_name
    ,i.name AS index_name
    ,p.partition_number
    ,rows
FROM sys.partitions AS p
INNER JOIN sys.indexes AS i ON p.object_id = i.object_id AND p.index_id = i.index_id
INNER JOIN sys.partition_schemes ps ON i.data_space_id=ps.data_space_id
INNER JOIN sys.objects AS o ON o.object_id = i.object_id
ORDER BY index_name, partition_number;
GO

Comments

# SSQA - SqlServer-QA.net said on July 17, 2007 2:46 AM:

If you have a huge number of partitioned tables and indexes then the following query would help you to

Anonymous comments are disabled

About SQL Master

**__________________________________** SQL Server MVP, Sr. DBA & industry expert. - Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.

Search

Go

This Blog

«July 2007»
SMTWTFS
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

Syndication