Recently, I have been knee deep in doing a MySQL migration to Azure SQL. I quickly learnt that Azure SQL required a lot more attention than its MySQL counterpart. So an Index and Statistic maintenance plan was needed, and urgently to keep things humming along smoothly.
Much to my amazement, Azure SQL did not offer the typical SQL Server Agent! Everything in Azure is extra!!!
So I started doing a little digging and found a couple options. One potential solution which I was exploring was to create an Automation Account to run a Maintenance Stored Procedure on a daily/weekly basis. I only mention this as it may be an avenue worth exploring for some.
In my case, because the client I was helping already was using flow and was already using the premium SQL Server connector, I decided to go the Power Automate Flow route to automate the maintenance. Thus providing a solution at no extra cost to them.
The Overall Idea
My process is very straightforward:
- Create an Azure SQL Stored Procedure that performs the necessary index and statistic optimization
- Use Power Automates Flow to run it on the desired schedule
Continue reading →