-1

I am a SQL Server 2017 user, I deleted a table that had too many records, but after the delete process, the size of the MDF and LDF files did not decrease, but increased. I have shrunk the file but the file size remains the same. What should I do to change the file size?

I want the mdf file size to return to normal according to the existing record

2
  • How big is it currently and how much data (in physical size) was the table you deleted? Commented Mar 14 at 12:31
  • 1
    "I have shrunk the file" Which file? And how did you perform the shirnk exactly? Commented Mar 14 at 20:13

1 Answer 1

0

If you have run the SHRINKFILE command from SSMS GUI, the default variant ("Release used space") is running it with TRUNCATEONLY - which releases the free space only at the end of the file. Which might not be a alot of space freed. Perhaps that's what happened?

To return all the free space, select the "Reorganize pages before releasing the used space". (Obviously, this will take noticeably longer.)

SSMS GUI for shiking file, with the default option selected

3
  • I have run this but it still doesn't work, but I checked it for a few days, the space usage has decreased, is that really the case with SQL Server? Commented Mar 15 at 1:58
  • @RafardhanAthalla Sorry, I don't quite understand. The space should be freed immediately. Commented Mar 15 at 6:38
  • @RafardhanAthalla Actually, I've recently heard about such behavior from elsewhere, so I guess that may be thing that sometimes happen? Commented May 29 at 20:12

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.