Azure SQL Timeout
# help-with-other
s
I have a scheduled api call that fires off some sql. It's a Select with a couple of joins. It's been timing out. It has a TOP 5. Running the query locally it returned instantly. Then I noticed locally it was TOP 10. Changing to TOP 5 means it runs for 40+ seconds. What on merry earth would be the cause of that? Worried the db is getting unstable in someway.
I know MS-SQL likes to be a bit mystical some times and try different ways of running queries but usually after the first query it will optimise. This is bizarre.
s
That sound super weird indeed, any order by on complex compound or joined columns?
m
Have you looked at the execution plans SQL can give you?
m
Have a look at the query performance insight section on your database. Maybe it might reveal something? https://learn.microsoft.com/en-us/azure/azure-sql/database/query-performance-insight-use?view=azuresql
s
Sorry - lost in holidays, then the usual too much work (pre and post holiday working hard to try to make up for the "lost time"!) I lost track of this thread. Great tips all. If I get time to look at this again I'll update you on what it is / was / any more mystery.