Simple Index question

  • Good Morning All,

    Just a quick question...

    I have a table which updates on a daily basis after 11pm when no-one is here.

    Is it good practise to have the indexes build each day or each week?

    Each update adds approximately 10000 rows of data

    Thanks in advance

  • waxb18 (8/30/2013)


    Good Morning All,

    Just a quick question...

    I have a table which updates on a daily basis after 11pm when no-one is here.

    Is it good practise to have the indexes build each day or each week?

    Each update adds approximately 10000 rows of data

    Thanks in advance

    I don't think this has much to do with best practice. It depends on your maintenance window and the size of the table. If it's going to take a few minutes to rebuild the index then just do that every night.

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

    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

  • It's impossible to say. In the system I work there is a table to which a bunch of rows are added every night. This job usually completes in a few minutes. But after index rebuilds it runs for an hour.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

  • hard to say on index rebuilds, check the fragmentation daily to see how quickly the indexes fragment.

    You may want to update your stats after the upload though. Presuming you have auto update stats turned on for a table larger than 500 rows stats will only update automatically when (from BOL):

    'The table had more than 500 rows when the statistics were gathered, and the colmodctr of the leading column of the statistics object has changed by more than 500 + 20% of the number of rows in the table when the statistics were gathered.'

    If 10000 rows is not enough to trigger that your stats could be less than optimum.

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

  • You should keep an eye on the fragmentation of the index every day.

    If you notice the fragmentation growing to high ( > 30% ) you should consider rebuilding the index every n days depending on how many days it took for the fragmentation to reach 30%.

    There is no need to update statistics after you have rebuild your index, this happens with the rebuild action.

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

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