Find biggest tables in Partition Scheme and Filegroup

  • Hi,

    I have SQL Server 2008 SP1. I am looking the easy way to find the large tables in particular Partition Scheme as well as filegroup. Any quick help is highly appreciated.

    Thanks

    Neeraj

  • Hi

    You can look at joining sys.partitions to sys.allocation_units.

    Once you have that done you can just sum that data pages.

    that will give you the physical size.

    If you want the number of rows there is a function for partitions that will do this.

    USE AdventureWorks2008R2 ;

    GO

    SELECT $PARTITION.TransactionRangePF1(TransactionDate) AS Partition,

    COUNT(*) AS [COUNT] FROM Production.TransactionHistory

    GROUP BY $PARTITION.TransactionRangePF1(TransactionDate)

    ORDER BY Partition ;

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply