INFORMATION_SCHEMA for INDEX

  • Hello Everyone,

    It would be very helpfull to have a view called:

    INFORMATION_SCHEMA.INDEXES

    That gives informations about all the index from the current user in the database.

    Does this enhancement in place for Yukon?

    Best regards,

    Carl

     

     

  • I don't know about Yukon but :

    exec sp_helpIndex 'Table_ViewName'

    can get you started.

  • Hello Remi,

    For sure, the code behind sp_helpindex will help me, but it would be so nice and simple to have the same kind of information given by INFORMATION_SCHEMA for contraints or columns.

    Don't understand why it is not there.

    Regards,

    Carl

  • Sure would be nice... but it doesn't take lon to build the query to fetch the info yourself.

  • Hi,

    May be following query will be helpful for you OR someone else.

    select

    object_schema_name(object_id),

    object_name(object_id),

    name,

    'ALTER INDEX ' + name + ' ON '+object_schema_name(object_id)+'.'+object_name(object_id)+' REBUILD;'

    ,*

    fromsys.indexes

    wheretype > 0

    order by

    object_schema_name(object_id),

    object_name(object_id)

  • Thanks for pointing out the new system objects.

    Couples points.

    Heaps should not be ignored when doing index maintenance.

    You shouldn't blindly rebuild all index without there being a need for it.

    This is what I use to be as efficient as possible.

    http://sqlfool.com/2011/06/index-defrag-script-v4-1/

Viewing 6 posts - 1 through 5 (of 5 total)

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