Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rebuilding indexes online

Status
Not open for further replies.

baykey

Programmer
Aug 12, 2007
2
BE
I'm trying to write a script to run automatically and rebuild my indexes.

But I'm kind of scared of running it.
'Cause I don't know what the server does with the command.
What happens if I have a script that sends 20 "REBUILD WITH (ONLINE=ON);" commands to the server?

Are these 20 commands executed simultaneously (parallel), creating a peak in the server (and slowing everyone else down) , or are they done seperately (serial), creating a bit of lag but not taking out the server?

My project leader won't let me run the scipt, cause he fears server timeouts. So I have to run them manually 1 at a time...
 
Do you have a 'Go' statement between each ALTER INDEX statement? If you do then they will execute separately.
If you don't then it will execute as one large batch.

Keep in mind that maint scripts such as these should always be scheduled to run off hours or during off peak transaction time.

- Paul
- If at first you don't succeed, find out if the loser gets anything.
 
yeah I'm using a GO statement,
but if I write
ALTER INDEX A...
GO
ALTER INDEX B..
GO

will the script wait with altering the index B untill index A has been changed?

Because it can take a bit off time and if the rebuilding happens on another thread I might be spawning 15-20 thread clogging up disk acces on the DB...
 
Yes, it will run each statement individually.


- Paul
- If at first you don't succeed, find out if the loser gets anything.
 
If the T/SQL commands are run from a single script then are run in series.


Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top