Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Vijay Kumar 2,036 Reputation points
2021-07-07T20:32:35.56+00:00

Hi Team,

We are getting below error while running query in SSMS:
Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Normally it shouldm't take more than 2 mins. But from yesterday onwards, the query failing with above error.
It is SQL Server 2016 With SP2 (CU17)

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,981 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,654 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 112.7K Reputation points MVP
    2021-07-07T21:51:14.297+00:00

    By default, SSMS waits forever for a query to complete. If you get this error, this is because you have set a query timeout under Tools->Options->Query Execution->SQL Server->General->Execution time-out. You can also change it for the current window, by right-clicking and selecting Query Options from the bottom of the context menu. Set the time-out to 0 to wait forever.

    As for why the query is running slower than yesterday... Well, have you investigated if it may be due to blocking? Else it is not unheard of that the execution plan changes, because of updated statistics or some other reason. And sometimes when the optimizer takes a wrong bet, the query can be a lot slower.

    Do you have Query Store enabled on the database?

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. AmeliaGu-MSFT 13,986 Reputation points Microsoft Vendor
    2021-07-08T03:05:55.173+00:00

    Hi VijayKumar768,

    In addition, please try to clear the statistics to make sure the database's statistics and/or query plan cache are correct:

    exec sp_updatestats
    

    And please try to track the query using SQL Server Profiler to see if can get some clues.

    Best Regards,
    Amelia

    2 people found this answer helpful.

  2. Andrew 6 Reputation points
    2021-08-05T08:36:07.917+00:00

    I had the same problem - after regularly running large queries, suddenly getting a timeout on some - but not all? - queries.

    I tried Tools->Options->Query Execution->SQL Server->General->Execution time-out - changed the value there from 15secs to 600secs - but I had to update the setting in Query>Query Options to fix it properly.

    Was it a SSMS update that changed the settings? It's been working fine up until last Thursday (29 July)

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.