I have a SQL Azure database with a stored procedure that is returning just one row with 10 columns.
If I execute this stored procedure in Azure it takes 4 minutes.
Then I copied the database in local via dacpac file. So the database is exactly the same right?
When I executed the same stored procedure locally, then it takes less than 1 seconds.
Any idea? Can't be the network latency.
Erland Sommarskog solved my problem on msdn. So the solution was UPDATE STATISTICS by runnning "EXEC sp_updatestats" on the Database.
And the running time is now 1 seconds instead 4 min...
For more details: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/283bd059-0231-415f-99ec-284beeccbafb/sql-stored-procedure-so-fast-in-local-so-long-in-azure?forum=sqldatabaseengine#169873f3-7e39-4c52-995e-d8fb72abe7c2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With