Link to home
Start Free TrialLog in
Avatar of bleonardi
bleonardi

asked on

SQL Server 2008 R2 - Optimize task runs very long

I run the Optimize task from the built-in maintenance plans once a week.  The database is 46.4 GB.  The Optimize job runs > 20 hours.  Is this Normal for a database of this size?  What can be done to reduce run time?
SOLUTION
Avatar of Mohit Vijay
Mohit Vijay
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bleonardi
bleonardi

ASKER

Took me a little while to review the articles referenced by XGIS.  

We run a shrink job every night.  The log files are not exceptionally large.

Basically, what I am taking from your comments is that I need to focus on the index structure, and then secondarily minimizing fragmentation in the indexes.  Correct?
if above question to me, then answer is yes.
Hello  bleonardi.. thankyou for the points.. pls advise if you have performed a shrink via command line and not SSMS.  Particularly your logfile, because sometimes it does not shrink properly inside SSMS. Also I have seen apps like DNN in the past the have settings that make their logfiles blowout very frequently.. so often that you needed to run a shrink process weekly.
As for indexing and so forth what type of data are you storing.  eg if you are storing images in the database as binary and not as file paths this can be an issue.  Also you may benefit from some normalisation.  eg replace words with numbers for common values.  These things can be daunting if you are not confident in sql execution. Always make a backup for testing etc.
I actually use a sql chaining type scenario in sql express 2012, where each database has a maximum size of 10gb, and a new one generates each time the other fills up.  eg10million records.  I use a MASTER database to mange the CHILD databases which enables me to run queries across all databases at once.  Maybe this approach is something to consider.