Disabling Indexes

  • Comments posted to this topic are about the item Disabling Indexes

  • Nice question.

    To me it seems rather obvious that if you disable the clustered index then no other index on the table will work because all the other indexes identify rows the row by reference to the clustered index key (including any hidden uniquifier) for the row. So two seems a lot of points for this question. But as two of the first five answers are wrong maybe it isn't quite as obvious as it seems.

    Tom

  • Good question & good information, thanx.

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Nice one. As soon as I saw option #3, I selected and scored 2 points.

    Thanks.

  • Great question! Thanks.

    Igor Micev,My blog: www.igormicev.com

  • In my opinion it's unimportant, if the other indexes are disabled or not. You can't reach the table data with a disabled clustered index.:-D

  • good question, Thanks

  • Strange. It looks to me that the primairy key index isn't disabled.

    I scripted all 3 keys and noticed that only at the 2 non-primairy indexescript had an extra line inserted like :

    ALTER INDEX [SalesArchive_NCI_SalesDate] ON [dbo].[SalesArchive] DISABLE

    How can you see then that the primairy key index has been disabled ?

  • ArnoKwetters (6/8/2015) How can you see then that the primairy key index has been disabled ?

    In the Message pane when you execute the Index disable code.

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • This was removed by the editor as SPAM

  • Hello Hany,

    Yes you are right.

    I was already a step forward.

    I didn't look well in the Message pane.

    Thanks.

  • ArnoKwetters (6/8/2015)


    Strange. It looks to me that the primairy key index isn't disabled.

    I scripted all 3 keys and noticed that only at the 2 non-primairy indexescript had an extra line inserted like :

    ALTER INDEX [SalesArchive_NCI_SalesDate] ON [dbo].[SalesArchive] DISABLE

    How can you see then that the primairy key index has been disabled ?

    You can also check the disabled/enabled indexes with the below query

    select sys.objects.name as 'table',

    sys.indexes.name as 'index',

    is_disabled = case is_disabled

    when '1' then 'disabled'

    when '0' then 'enabled'

    end

    from sys.objects join sys.indexes

    on sys.objects.object_id = sys.indexes.object_id

    where sys.objects.name = 'SalesArchive'

  • Thanks PMA...

    That is a nice script.

    It is still strange that when I scripted the Indexed, it was not obvious that the primairy key was disabled.

    This script does.

    Thanks again

  • nice question...

    Manik
    You cannot get to the top by sitting on your bottom.

  • Good question.

    Last month , I have done some tests to compare both versions 2008 R2 and 2014 and I have some problems.

    2008 R2 accepts to script everything even disabled indexes , but it seems that SQL Server 2014 is more constraining as it is unable to provide the full script for all the objects of a database having disabled indexes on a table.

    I have done this test with the same values for the Scripting options for 2008 R2 and 2014 with both versions 2008 R2 and 2014 of the SSMS ( Right-cclick on the database name , Tasks , Generate Scripts ) .I have done these tests to see the différences of behaviour between these both versions.

    Any comment on these tests would be appreciated as I have found nothing about this difference in the forums/blogs MSDN.

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

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