Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 )

share|improve this question
    
Please don't double post on the sites. If you want a question moved to a different site please flag it for moderator attention and list the site you want it moved to. Thank you. –  Chris S Jun 24 '10 at 12:34

3 Answers 3

Windows Vista and Windows 7 and SQL Server 2008 do have a different connection method than XP and SQL Server 2008.

When you connect to a Windows 2008 server running SQL 2008 from Vista or Windows 7, Windows tries to negotiate a connection using Security Support Provider Interface [SSPI]. You will occasionally see issues as detailed in http://support.microsoft.com/kb/811889.

My best guess it there is a delay in negotiation of this connection. As you can see in the KB article, there are ways to force the connection to just use standard NTLM negotiation.

I would try to force NTLM by adding SSPI=NTLM to your connection string. If you no longer get the initial speed reduction, this probably points to your problem.

share|improve this answer

Are you connecting to this machine by IP or hostname?

What happens when you exclusively address this machine by its IP address only? (via connection string or SQL Management Studio)

share|improve this answer

Check your SQL Client Connection settings (TCP/IP first?)

Add an entry to your SQL 2008 machine in your hosts file. If that gives you fast performance after a reboot, you're looking at a name resolution issue.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.