SQL Server misunderstanding: database file shrinking on the last 30 days will not affect performance

Source: Internet
Author: User

Misunderstanding #9: database file shrinking does not affect performance

Error!

The only condition that shrinking database files does not affect performance is that the truncateonly option is specified when there is space at the end of the file.

The process of shrinking files has a significant impact on performance. This process requires moving a large amount of data to cause a large amount of Io. This process will be recorded in the log, resulting in log spikes, it also occupies a large amount of CPU resources.

Not only does the contraction affect the performance, but it also affects the performance after the file is shrunk. A large number of logs generated by the contraction will be transferred by transaction logs, images, and copies can be executed repeatedly. When there is not enough space, the file also needs to be initialized with 0 to affect the performance (unless you do not need to fill in the initialization option ).

This is not the worst case. The worst result is that file shrinkage causes a large number of index fragments, which affects the performance of scan operations.

Unfortunately, the database is shrunk.CodeIt's not what I wrote (if I did, I wouldn't allow this mechanism in the first place), so the only thing we can do is accept this operation.

If you want to find a method to replace database file shrinking, please read this blog post: Why you shoshould not shrink your data files, or you should plan the file at the beginning: importance of data file size management. Also, this article: TGIF time warp.

Remember this:

  • Shrinking data files is evil.
  • Database shrinking is more evil
  • Automatic contraction is nothing more than evil.

Simply saying "no" can keep us away from the troubles.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.