-1

I have deleted some of the tables on the SQL server2019 database this table is around 1.5TB. And already shrink the database but there is no effect.

2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Feb 10 at 9:54
  • This database (4TB) and I have already dropped some tables total of 1.5TB, But the disk space still growing up and not reducing (like 4TB to 2.5TB)
    – bro.visal
    Feb 10 at 10:26

1 Answer 1

1

I have already dropped some tables total of 1.5TB, But the disk space still growing up and not reducing...

If your database's total size is still increasing after dropping 1.5 TB of tables, then that means your database is really already using that much space again for something else.

When you drop a table, regardless of running a Shrink operation or not, the disk space that table was consuming will now automatically be overwritten by new data as it comes into the database. That space (even when still consumed on the disk itself) is now available internally, and will be used first, before the database grows further in size. Therefore if the database grew in size, it means it already re-used all of that freed up space internally.

The only difference with a running a Shrink command is it releases the space back to the drive / OS. But again, without Shrinking, the space is still free internally, and the database will re-use it for new data first before growing.

Also, Shrinking only releases the freed up space back to the disk, that's at the end of the file. This is why you won't always see the disk reclaim all of the space you'd expect when running a Shrink command. But again, from the database's perspective, it doesn't matter if you Shrink or not. The database will re-use the space regardless.

Shrinking data files recovers space by moving pages of data from the end of the file to unoccupied space closer to the front of the file. When enough free space is created at the end of the file, data pages at end of the file can be deallocated and returned to the file system.

1
  • 1
    Thank you so much now has been solved. Your Idea helps me to solve these issues. Best Regards,
    – bro.visal
    Feb 13 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.