Table Valued Function: Util.Metadata.GetIndexPhysicalStats

CREATE FUNCTION Metadata.GetIndexPhysicalStats (@database_id SMALLINT,
                                         @object_id INT,
                                         @index_id INT,
                                         @partition_number INT,
                                         @mode SYSNAME)
RETURNS @result TABLE ([database_id] SMALLINT NULL,
                       [object_id] INT NULL,
                       [index_id] INT NULL,
                       [partition_number] INT NULL,
                       [index_type_desc] NVARCHAR(60) NULL,
                       [alloc_unit_type_desc] NVARCHAR(60) NULL,
                       [index_depth] TINYINT NULL,
                       [index_level] TINYINT NULL,
                       [avg_fragmentation_in_percent] FLOAT NULL,
                       [fragment_count] BIGINT NULL,
                       [avg_fragment_size_in_pages] FLOAT NULL,
                       [page_count] BIGINT NULL,
                       [avg_page_space_used_in_percent] FLOAT NULL,
                       [record_count] BIGINT NULL,
                       [ghost_record_count] BIGINT NULL,
                       [version_ghost_record_count] BIGINT NULL,
                       [min_record_size_in_bytes] INT NULL,
                       [max_record_size_in_bytes] INT NULL,
                       [avg_record_size_in_bytes] FLOAT NULL,
                       [forwarded_record_count] BIGINT NULL,
                       [compressed_page_count] BIGINT NULL)
BEGIN
    INSERT  INTO @result
            SELECT  *
            FROM    sys.dm_db_index_physical_stats(@database_id, @object_id, @index_id, @partition_number, @mode)

    RETURN
END

Description for Table Valued Function: Util.Metadata.GetIndexPhysicalStats

Todo
Site Map | Printable View | © 2008 - 2012 NuRoN Consulting, INC | Powered by mojoPortal | HTML 5 | CSS | Original design by Andreas Viklund
Share This Using Popular Bookmarking Services