Since Azure SQL databases are limited in what they expose to the management studio client we miss out on a lot of features within SSMS that we could normally use. One of the most common features we use frequently in this regard is the Rebuild Indexes and update statistics features within Maintenance Wizard.
Below is a very simple script that can be used to rebuild all indexes on all tables without regard to fragmentation. This could blow up the DTUs if you’re performing the common on a table with large number of records of in correct DTU sizing for the Azure SQL database.
SELECT 'ALTER INDEX ALL ON [' + Table_schema + '].[' + Table_name + '] REBUILD;' FROM information_schema.tables WHERE Table_schema != 'sys' GO EXEC sp_updatestats
This script is provided for use in databases managed by people who are not professional DBAs but still require scripts to perform basic tasks without having to worry about the complexity involved.