Queries taking too long from Azure SQL Database

I use an Azure SQL database. I'm getting what I think are very slow query times. I've created a really simple query in a Retool app, and I have a powershell script that performs the same query, so I can compare the two. The query is very simple:

select * from product where product_number = convert(int,rand()*100+1000)

(The product table has a int PK starting at 1000 and only has 167 rows)

This query takes an average of 55ms roundtrip via the powershell script, versus 1000-3000ms via Retool.

I know there is significantly more overhead involved with Retool versus the script, but this seems very slow. Does anyone have any idea what might be going on?



I have "moved" the SQL server and database from Australia East (as we are based in NZ) to US West 2 (to align with Retool) and I've seen a significant improvement: Now that query is taking under 500ms. The powershell script is now taking a longer time (250ms vs 50ms) due to - presumably - the fact that the azure datacentre is now much further away from me.

In summary, I think problem is solved :wink:

1 Like