SQL Server stored procedure performance suddenly down - sql-server

I have a stored procedure which is loading a huge amount of data into a table. Suddenly it's run time has increased to a very high extent. Earlier it was taking ~2 minutes, now it's taking ~20 minutes. What could be the reason and how to debug the issue ? I am using SQL Server 2014.

Related

Stored procedure takes time on database server using SQL Server

When I run the stored procedure on the local machine's SQL Server, it takes 2 seconds, but on the database server, it takes 10 seconds.
For both, local and database server, the execution plan is the same.
How do I find out the reason for taking too much time to execute the stored procedure?
Thanks.
ExecutionPlan

PAGEIOLATCH_SH Does Not Release In SQL Server

I have a stored procedure running on SQL Server 2014 with the strangest issue.
The procedure, which is admittedly complex, runs in SSMS in about 2 seconds. It runs as a job under the SQL Agent in at most 2 seconds.
The same stored procedure, when called by a .Net web service, hits a permanent PAGEIOLATCH_SH block and will not run in even 5 or 10 minutes. Even after adding every conceivable index, clearing the cached plans repeatedly, shrinking the log file, clearing disk space, and rebooting the server.
What could possibly account for this behavior?

SQL Server stored procedure long running intermittently

I have 5 stored procedures, called by an api, that run in under 100 ms normally, but intermittently, all the stored procedures suddenly take > 10 seconds in production. We did stress test before going live and it was all good during stress test.
For each of the stored procedures, I capture start time using SYSDATETIME() and log it an table at the end of the stored procedure with end time as well. So I run profiler on production and notice strange things.
For example, today, profiler RPC:completed event start time is 09:18:04.680 where as my stored procedure execution log tables says the execution started at 09:19:54.288. So there is a 110second mismatch between profiler execution start vs my stored procedure internal start time. So this happens to all stored procedures for a window of 2-3mins and everything clears by itself.
I've ran perfmon and nothing shows out of ordinary to me. The SQL Server has high capacity with the application only running few users currently so not a very high traffic application.
I also have Redgate SQL Monitor and it doesn't show any abnormal wait times.
I'm not even sure where to look for. I'm not sure its parameter sniffing because one of the stored procedure affected doesn't accept any parameters. After the 2-3 minutes all the stored procedures run as expected.

much different time in executing a query for first time

I have a query which I ran on my server, I used SSMS for this action then I use Live Query Statistics.
In the middle of running first query, I copied query and ran it in parallel with my first query, unexpectedly it took about 25 seconds to be done but my first query still was running for about 10 minutes.
Beside the difference between execution time, SSMS live query shown with about 9 minutes delay in my first query.
Why I got that large difference in execution time? Some sort of blocking?
SQL SERVER : SQL SERVER 2016 core-based.
Windows Server : 2016.
SSMS : 2016.

Procedure running slow in first attempt after migration SQLSERVER 2005 to 2012

Recently we have migrated SQLServer 2005 to 2012 and seen huge slowness in stored procedures execution.it's taking long time in first attempt but as on expected time in second attempt. I was under impression this may be due to caching but I have used "dbcc freeproccache" but When I'm executing all procedures again they are taking expected time, I don't have seen any performance issue on first attempt to nth times after executing "dbcc freeproccache". To improve the performance
I already did following things which are not working for me.
Rebuild the indexes.
Updated historic stats using 100% sampling data.

Resources