An Azure sql database is super easy and cheap to setup and use. However, if you want to do some serious data manipulation, you will find the cheapest versions are to slow to use, and every upgrade you make on the sql database, is a doubling in price. If you are a data engineer, like me, most of your data work will be in batches, so it will also be annoying to pay for an expensive version, if you only use it for 1 hour/day.
Luckily, there is a solution. You can change the performance / version of the SQL server with SQL.
To check which version you are running, use this SQL
SELECT
slo.edition,
slo.service_objective
FROM sys.database_service_objectives slo
And you will get a result like this
You can change the version with this SQL
ALTER DATABASE DSA MODIFY(EDITION='Standard' , SERVICE_OBJECTIVE='S4')
Unfortunately, the change is not instant. My experience is, that on the standard version, the latency is around 5-10 minuttes.
What i normally do, is that I have a job that starts 30 minutes before my batch job, that update the database to a higher version. Then it is updated when the batch starts. And I set the batch job to downscale the database in the end.
For pricing and DTUs, see the screenshot below.
Pricing for all versions can be found here: https://azure.microsoft.com/en-us/pricing/details/azure-sql-database/single/
Have fun 🙂
Leave a Reply