SQL server queries are really slow only on first run
        Posted  
        
            by JoelFan
        on Server Fault
        
        See other posts from Server Fault
        
            or by JoelFan
        
        
        
        Published on 2010-01-06T17:27:02Z
        Indexed on 
            2010/03/27
            17:03 UTC
        
        
        Read the original article
        Hit count: 550
        
Somewhat strange problem... when I start my .NET app for the first time after rebooting my machine, the SQL Server queries are really slow... when I pause the debugger, I notice that it's hanging on getting the response from the query. This only happens when connecting to a remote SQL server (2008)... if I connect to one on my local machine, it's fine. Also, if I restart the app, it works fast, even off the remote SQL server, and subsequent runs are also fine. The only problem is when I connect to a remote SQL server for the first time after rebooting my machine. What's more, I have even noticed this same exact behavior with a 3rd party app (also .NET) that also connects to a remote SQL server.
Another piece of info... this has only started hapenning since I upgraded my machine from XP to Win7 (64 bit). Also, other developers on my team who upgraded to Win7 are seeing the same behavior (both with the app we're developing and the 3rd party .NET app).
(copied from http://stackoverflow.com/questions/2014814/sql-server-queries-are-really-slow-only-on-first-run )
© Server Fault or respective owner