Azure SQL Database is charging unexpected high costs

60 Views Asked by At

I have an Azure SQL database that is connected to python code which scrapes data into the database four times a day. The database is also connected to a tableau cloud dashboard which refreshes the extract roughly 30 mins after the data has been scraped.

The estimated monthly costs is said to be around 5$ a month with being charged per second of usage but I am being charged upwards of 5$ per day which would come out to hours of usage.

I have checked my code to ensure it closes the connection after accessing the database and I have set the auto-pause to its lowest setting of 1 hour. Am I running into a problem where because my database is accessed 8 times day, the connection remains open for 8 hours until the auto-pause delay stops it?

I am curious to know whether this is normal for what I am trying to do or if I am doing something wrong and paying the price for it.

enter image description here

enter image description here

1

There are 1 best solutions below

0
Francesco Mantovani On

This is what is happening:

  1. Let's say that you Python script runs at 1:00pm.
  2. At 1:30pm Tableau kicks in and refresh the data, maybe for other 30 minutes, till 2:00pm.
  3. Now it's 2:00pm, we need to wait 1h for the Azure SQL Database to enter in auto-pause.
  4. Now it's 3:00pm, the database starts the auto-pause.
  5. Now it's 4:00PM, time to wake up, the Python script is running again.

So if this is happening 4 times a day your Azure SQL Database is sleeping 4 hours max.

Serverless is suggested for databases that receive no connections for more than 50% of the time and this is not your case.

Use an S1.