SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Simple Index question


Simple Index question

Author
Message
waxb18
waxb18
SSC-Addicted
SSC-Addicted (499 reputation)SSC-Addicted (499 reputation)SSC-Addicted (499 reputation)SSC-Addicted (499 reputation)SSC-Addicted (499 reputation)SSC-Addicted (499 reputation)SSC-Addicted (499 reputation)SSC-Addicted (499 reputation)

Group: General Forum Members
Points: 499 Visits: 118
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
Abu Dina
Abu Dina
SSCertifiable
SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)

Group: General Forum Members
Points: 7273 Visits: 3325
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

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
Erland Sommarskog
Erland Sommarskog
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13294 Visits: 879
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.

Erland Sommarskog, SQL Server MVP, www.sommarskog.se
george sibbald
george sibbald
SSC Guru
SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)

Group: General Forum Members
Points: 58540 Visits: 13706
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.

---------------------------------------------------------------------
Enrico van de Laar
Enrico van de Laar
SSC Veteran
SSC Veteran (239 reputation)SSC Veteran (239 reputation)SSC Veteran (239 reputation)SSC Veteran (239 reputation)SSC Veteran (239 reputation)SSC Veteran (239 reputation)SSC Veteran (239 reputation)SSC Veteran (239 reputation)

Group: General Forum Members
Points: 239 Visits: 251
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search