Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Will shrinking the DB improve time taken by index rebuild process ? Expand / Collapse
Author
Message
Posted Tuesday, June 11, 2013 1:40 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, August 18, 2014 8:25 AM
Points: 1,519, Visits: 2,550
Experts,

Will shrinking the DB improve time taken by index rebuild process ?
If yes, why ?


Thanks,
Smith.
Post #1461903
Posted Tuesday, June 11, 2013 1:56 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 8:43 AM
Points: 223, Visits: 1,720
No. After shrink index rebuild process can take more time if there will be not enough free space in the DB file to rebuild index.
Post #1461911
Posted Tuesday, June 11, 2013 1:57 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:07 PM
Points: 42,812, Visits: 35,931
No. Increase it if anything as the data file will have to regrow.

Regular shrinks of the database file should not be done.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1461913
Posted Tuesday, June 11, 2013 3:48 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, August 21, 2014 3:52 PM
Points: 5,988, Visits: 12,923
plus the shrink will cause heavy fragmentation so there will be more for the rebuild\reorg to do.

---------------------------------------------------------------------

Post #1461966
Posted Monday, June 17, 2013 1:36 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, August 18, 2014 8:25 AM
Points: 1,519, Visits: 2,550
Thank you all.
Just one more query..
What are thr things that we need to do to speed up the index rebuild process ?..... in brief...
Thanks again.

Post #1464012
Posted Monday, June 17, 2013 3:47 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:07 PM
Points: 42,812, Visits: 35,931
Joy Smith San (6/17/2013)
What are thr things that we need to do to speed up the index rebuild process ?..... in brief...


Better IO subsystem.
More memory (maybe)
Reduce the need to rebuild indexes.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1464047
Posted Monday, June 17, 2013 4:13 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:34 PM
Points: 36,978, Visits: 31,498
GilaMonster (6/17/2013)
Joy Smith San (6/17/2013)
What are thr things that we need to do to speed up the index rebuild process ?..... in brief...


Better IO subsystem.
More memory (maybe)
Reduce the need to rebuild indexes.


To add to Gail's suggestions...

Partitioning of certain tables, such as audit tables (or other tables that don't usually suffer updates, just inserts), can help a lot if partitioned by row creation date. For example, I have an audit table at work that I'm setting up to partition by creation date. It has almost 3 years of data in it and the table has about 25GB of data in it. Even though the clustered index is in good shape (based on the IDENTITY column) and never needs reindexing (follows Gail's suggestion of "Reduce the need to rebuild indexes"), the other indexes take quite some time. When I'm done partitioning it, I'll only need to reindex the "current month" partition.

I'm also moving all but the last 3 months of audit partitions to another database (using partitioned views so I can put them in a different DB) so that my backup and restore times will be reduced by quite a bit. During a restore for DR, it's much more important to get the database back up and running than it is to restore 3 years of audit data which can be done almost leisurely after the main database is up.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1464057
Posted Tuesday, June 18, 2013 2:38 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 9:20 AM
Points: 2,868, Visits: 3,211
The main way to speed up index rebuilds is don't do them if they are not needed. Ola Hallengren http://ola.hallengren.com/ publishes an index rebuild routine used around the world that processes only those indexes that need work on them.

Original author: SQL Server FineBuild 1-click install and best practice configuration of SQL Server 2014, 2012, 2008 R2, 2008 and 2005. 28 July 2014: now over 30,000 downloads.
Disclaimer: All information provided is a personal opinion that may not match reality.
Concept: "Pizza Apartheid" - the discrimination that separates those who earn enough in one day to buy a pizza if they want one, from those who can not.
Post #1464504
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse