OdeToCode IC Logo

Connections & Assumptions

Friday, April 23, 2004

I never realized you bypass the network protocol stack when connecting to SQL Server on the the same physical machine. At least you CAN bypass the protocol stack if you use the correct settings. I learned this from Ken Henderson's SQL Server Connection Basics on MSDN. Excerpt:

You can indicate that the shared memory Net-Library should be used by specifying either a period or (local) as your machine name when connecting. You can also prefix your machine\instance name with lpc: when connecting to indicate that you want to use the shared memory Net-Library.

I regularly connect to a SQL instance on my desktop at work by using SALLEN\dbs1, meaning I am using the protocol stack instead of shared memory. Shared memory is generally quicker, but not always. As Ken says, make sure to test first for your specific environment.

Of course, for development, I'm sure it won't make a noticable difference at all, but this is a good tip to remember. I always assumed SQL would not optimize for a local connection, but then my assumptions always come back to bite me.

Yesterday I was assuming I was in the correct departure gate for a flight out of Toronto. To make a long story short – I discovered with 5 minutes to go before boarding that I was in the wrong area. The conversation went something like this

Wondering Woman : Is this the flight to Pittsburgh?

Me: I think this is the gate for a flight to Baltimore

Man in another seat: I’m here for a flight to Indianapolis.

I knew two of us had to be wrong, and one of those two was probably me. For some reasons airports do their best to confound me. I had to move from gate T to gate E in YYZ’s Terminal 2, which, as one airport employee described to me with a grin, is “one heck of a walk”. Yep. I felt like I was trying to break the 4 minute mile with two carry on bags in tow. It also involves a shuttle bus ride. The kind of shuttle bus ride where you want to pound on the glass separator and tell the driver to floor it but are restrained just enough by the thought of being arrested as an airport lunatic. Fortunately, I made the plane and was on enough of a post-panic comedown to actually nap for a bit.