We help IT Professionals succeed at work.

SQL Server Shrink hurting performance?

s_sykes
s_sykes asked
on
182 Views
Last Modified: 2017-03-23
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?
Comment
Watch Question

lcohanDatabase Analyst
CERTIFIED EXPERT

Commented:
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/
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
s_sykesIT Director

Author

Commented:
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.
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
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.