Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 51
  • Last Modified:

Azure SQL DB?

I have a database in Azure SQL. It is 50 GB in size. I made changes to many of its columns, changing nvar to var, deleting rows, but the size remains about the same. I Exported it to a backpac and imported the backpac to a local SQL Server 2016 and the local db shows its size about 34 GB. I am thinking that Azure is not compacting the db after these changes. Is there something I could/should run for Azure to compact the db?
0
Jess31
Asked:
Jess31
  • 2
1 Solution
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Isn't about compacting. Things in SQL Server aren't really deleted but marked as delete. When you run a reindex the data pages will be organized and all columns marked as deleted will be physically removed.
That's also the behavior for a Restore command.
1
 
Jess31Author Commented:
Is there away for me to have Azure physically remove the deleted items similar to what it does on a Restore?
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Use the REBUILD command:
ALTER INDEX ALL ON TableName
REBUILD

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now