Julian50
Julian50

Reputation: 2582

SQL Server stored procedure so fast in local so long in Azure

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.

Upvotes: 5

Views: 1337

Answers (1)

Julian50
Julian50

Reputation: 2582

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

Upvotes: 5

Related Questions