In the SHRINKFILE command, SQL Server isn’t careful about where it puts the pages that are moved from the end of the file toward the beginning of the file.
Data becomes fragmented, potentially up to 100 percent, and hence it is a performance killer for the database.
Slow operation: All pointers, being moved to/from the page/rows, have to be fixed and the SHRINKFILE operation is single-threaded, so it can be really slow (the single-threaded nature of SHRINKFILE is not going to change any time soon)
Recommendations:
First, use TRUNCATEONLY to shrink the file. It removes the inactive part of the log and then performs the shrink operation.
Rebuild/reorganize indexes once the shrink is done so that the fragmentation level is decreased.
Learn more about SQL Server from Intellipaat's SQL Programming Tutorial for Beginners and take your career to the next level!