Avatar of s_sykes
s_sykes
Flag for United States of America asked on

SQL Server Shrink hurting performance?

I inherited a SQL server and the performance is not the best.  I noticed that the front end app that uses the database moves data between several tables when it starts each morning and then runs a shrink on the database.  It looks like there is a weekly maintenance task that rebuilds indexes and then runs a shrink on the weekend as well!

When I looked at the indexes today, there are many that are heavily fragmented.  Autogrowth is set to 1MB, unlimited.  I know this setup has been in place for a year or so.  The database is around 20GB.  Large chunks of data are moved in and out of the database regularly.

If I stop the shrink operations and rebuild the indexes, will that fix my problem?  Or is the database likely in a state where more drastic action is needed?
SQLMicrosoft SQL Server 2008

Avatar of undefined
Last Comment
arnold

8/22/2022 - Mon
lcohan

Which files of the database are shrinked?
IF only T-log than is not that bad but indeex if MDF data files are shrinked as well then indexes will be fragmented so AFTER the shrink you should run a REBUILD and SP_UPDATESTATS  instead of before the shrink.


You could read a lots of good advice here:

https://www.brentozar.com/archive/2009/08/stop-shrinking-your-database-files-seriously-now/
ASKER CERTIFIED SOLUTION
arnold

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
s_sykes

ASKER
Yep - I did read that.  That's why I'm wondering of the database is completely messed up and need to be redone in some form to fix it.
arnold

First thing to try, disable the daily shrink or make sure auto shrink is not set. But monitor the growth.
Look at index fragmentation.

After shrink/allocate is not the issue, see if you could identify where the performance slowness is coming from, i.e. Specific queries/pages ... Then ......

You could use SQL tunning advisor to capture/analyze the operation and see what recomendations are made.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes