performance - SQL Server query taking up 100% CPU and runs for hours -


I have a query that is running every day for more than two years and usually takes less than 30 seconds Is complete Suddenly, yesterday, the query began to take 3+ hours to complete and was using 100% CPU all the time.

is SQL:

  SELECT @id, alpha. A, alpha. B, alpha C, beta.x, beta. Y, beta. Z, Alpha. P, alpha QFOR [different database]. DB.FGGetStaf (IID) Beta Inner VV Somadata Alpha on Beta.id = alpha.id  

alpha .id is a bigger type and beta. Id is an INT type I dbo.fnGetStuff () is a simple save content that contains 2 inner goggles on the table in the same DB, a WHERE id = @id < Using / code>. The function returns approximately 11000 results.

View vwSomeData is a simple selection statement with two INNER Johns that gives approximately 590000 results.

Both views and functions will be completed in less than 10 seconds if executed by themselves. First, selecting the results of a function in a temporary table, and then joining it ends the query & lt; 10 seconds.

How can I troubleshoot what is going on? I do not see any lock in the activity manager.

Check the query plan My guess is that in the execution plan there is a table scan or more, as a result of which you received There will be huge amounts of I / O for some records that occur.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -