Index

  • Hi All,

    How to find all the user defined indexes in a database. And is this possible to find their fragmentation level at a time ?

    Thanks in Advance

    Thank You.

    Regards,
    Raghavender Chavva

  • Raghavender (12/4/2009)


    Hi All,

    How to find all the user defined indexes in a database. And is this possible to find their fragmentation level at a time ?

    Thanks in Advance

    Raghavender ,

    Read the first link added in my signature.

    Muthukkumaran Kaliyamoorthy
    https://www.sqlserverblogforum.com/

  • Hi,

    As per gail suggest,I remove the Deprecated objects in my script .I think this ll post with in two days.(After posted u can change it)

    FYI,

    http://www.sqlservercentral.com/Forums/Topic827173-146-2.aspx#bm828000

    Muthukkumaran Kaliyamoorthy
    https://www.sqlserverblogforum.com/

  • Raghavender (12/4/2009)


    How to find all the user defined indexes in a database.

    Query sys.indexes

    And is this possible to find their fragmentation level at a time ?

    Query sys.dm_db_index_physical_stats

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Ok,

    Is this possible to find out the indexes on a single talble, not for whole database.

    Thanks

    Thank You.

    Regards,
    Raghavender Chavva

  • and the query should compatible for both 2005 and 2000.

    Thanks and Regards!!

    Thank You.

    Regards,
    Raghavender Chavva

  • Sure. Query sys.indexes (sysindexes on SQL 2000) and filter by object_id (id on SQL 2000)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi Muthukkumaran,

    I have tried your script of index defrag, but unable to defrag a single percentage down in our production environment.

    exec USP_DBA_INDEX_DEFRAGMENTATION DBName is the query I have used.

    can you please dig into it.

    Thanks and Regards!!

    Thank You.

    Regards,
    Raghavender Chavva

  • How big are those indexes? How many pages?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Its around 8000 to 10000 Pages and fragmentation around 50%

    And some of the indexes are about 200 to 800 pages, their fragmentation level is around 80% and they are also not able to defrag.

    Thanks and Regards!!

    Thank You.

    Regards,
    Raghavender Chavva

  • Those are big enough that there should be a reduction in fragmentation after a rebuild. Small ones often don't show much if any change.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • do your tables have clustered indexes?

    ---------------------------------------------------------------------

  • Yes, have both clustered and non clustered indexes.

    Thank You.

    Regards,
    Raghavender Chavva

  • then you should get improvement. Put debug statements in your code to see what is actually executed.

    ---------------------------------------------------------------------

  • If the fragmentation is as high as that you may want to consider rebuilding the index.

    Although without seeing the script you've been advised to run, im guessing it does that anyway based on that level of fragmentation?

Viewing 15 posts - 1 through 15 (of 18 total)

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