Results 1 to 4 of 4

Thread: Query Index

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    103

    Query Index

    Hi,

    When querying index statistics against my SQL 2005 environment, I am seeing mulitple entrees for the same Index with different percentages.

    I am using the following query

    Code:
    SELECT
    OBJECT_NAME(i.object_id) AS TableName,
    i.name AS TableIndexName,
    phystat.avg_fragmentation_in_percent 
    FROM
    sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'DETAILED') phystat inner JOIN sys.indexes i 
    ON i.object_id = phystat.object_id 
    AND i.index_id = phystat.index_id
    WHERE phystat.avg_fragmentation_in_percent > 10 
    order by TableName
    For example i have an index called 'IX_Sales'

    This index has 2 rows for 'avg_fragmentation_in_percent ', showing 15%,25%.

    How can one index have two rows and how can they be different?

    Thanks for any info.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    103

    Re: Query Index

    Anyone...???

  3. #3
    Lively Member
    Join Date
    Apr 2010
    Posts
    105

    Re: Query Index

    If you look at the expanded query you'll see there are different index levels
    I wrote a book Visual Studio 2008 Programming
    Amazon.com / Visual Studio 2008 Programming / By Jamie Plenderleith & Steve Bunn

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    103

    Re: Query Index

    Can you explain please

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width