A request that worked for several months

I have a request from a Delphi application that suddenly started counting down last week after working flawlessly for several months. even more, when it starts it, it slows down the server until other users believe that the system crashed Startup from Management Studio. I stop the request after more than 5 minutes of rotation SqlExpress 2008 R2 server ID

Now abusive request

SELECT     *
FROM        SignelOutilsListeJobs_View4
WHERE     (CreatedDate > (GETDATE() - 365))

It takes time to make this interesting, and the rows are returned when I just change the number of days ago. Activity Monitor Does Not Show More Than Request Is Running

SELECT     *
FROM        SignelOutilsListeJobs_View4 -- 00.00.02 38882 ROWS

SELECT     *
FROM        SignelOutilsListeJobs_View4
WHERE     (CreatedDate > (GETDATE() - 600)) -- 00.00.02 16217 ROWS


SELECT     *
FROM        SignelOutilsListeJobs_View4
WHERE     (CreatedDate > (GETDATE() - 500)) -- 00.00.02 13013 ROWS


SELECT     *
FROM        SignelOutilsListeJobs_View4
WHERE     (CreatedDate > (GETDATE() - 200)) -- 00.00.12  4118 ROWS

So, I’m wondering what’s going on here? Any ideas?

thanks

+4
1

GETDATE (Transact-SQL):

SWITCHOFFSET GETDATE() , GETDATE. GETDATE , . , OPTION (RECOMPILE), , . GETDATE() .

, :

SELECT *
FROM SignelOutilsListeJobs_View4
WHERE CreatedDate > (GETDATE() - 200) OPTION (RECOMPILE)

:

CREATE UNIQUE CLUSTERED INDEX SignelOutilsListeJobs_unique_index1
ON SignelOutilsListeJobs_View4 (CreatedDate, <some unique key>)

Microsoft TechNet:

+1

Source: https://habr.com/ru/post/1612764/


All Articles