Updating covering Index

  • Dear All,

    I have a covering index Idx1 on Col1 included Col2 and Col3.

    My question is if i run the following statement

    update tbl1 set col2=anyvalue

    will that update statement trigger an update on Idx1 or not?.

    I am asking that because i have a big table with a column included in many indexes and i am afraid that could have an impact on performance when executing update statements on that included column.

    Thanks in advance.

    Nader

  • nadersam (3/27/2013)


    will that update statement trigger an update on Idx1 or not?.

    Yes, I'm afraid it will.

    nadersam (3/27/2013)


    I am asking that because i have a big table with a column included in many indexes and i am afraid that could have an impact on performance when executing update statements on that included column.

    You may want to disable the indexes, perform your update then enable them again and perform index rebuilds.

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

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn

  • nadersam (3/27/2013)


    I am asking that because i have a big table with a column included in many indexes and i am afraid that could have an impact on performance when executing update statements on that included column.

    Have an effect, yes. Have a severe one, you need to test to see. Unless you're doing several updates in a row it probably won't be worth disabling all the indexes and rebuilding them after as the rebuild itself will take quite some time, plus you'll have the log impacts for all those rebuilds. Test though, see which is faster overall.

    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
  • I had a similar issue last week with a table of 80 million+ rows which had several indexes with included columns. But now I remember I had to perform several updates which basically took far too long. In the end I took the decision to disable the indexes before running my updates.

    As has been suggested you can try it with indexes and (without + index rebuilds) but either way is going to cost you time.

    However, if you're going to be doing this again in future, at least you'll know which option will take less time.

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

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn

  • Thanks for you reply

  • Dear Abu Dina and GilaMonster thanks very much for you replies

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

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