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


Simple Index question


Simple Index question

Author
Message
waxb18
waxb18
Valued Member
Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)

Group: General Forum Members
Points: 57 Visits: 111
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
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1283 Visits: 3323
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
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2173 Visits: 872
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
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10668 Visits: 13687
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 Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 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