03 November 2010
My Descendents Thank You
29 October 2010
Don’t waste my (users’) time
Here is a quick tale of a not-so-great performance optimization that really emphasizes the importance of making optimization decisions that actually have business value…
The case of a missed sort optimization
A business user and her colleagues currently sort and search a grid manually because "without some kind of 'sort' you have no idea where in the list your application will be found". These results apparently get scrambled each time the grid refreshes. The company is spending wage dollars (read “real money”) to do the work that the CPU could be doing for “free”.
10 September 2010
Alter Ego
A little more reading revealed that the internal database snapshot is implemented as an alternate stream of the live database file. And also that I have no control over where it's created, so it can cause a nearly full drive to fill up during a CHECKDB (the original reason for his original article).
I had never heard of an alternate stream before, but I did find a couple pretty good explanations, that I won't cover here, other than to mention that it's a feature of NTFS and allows multiple data streams to be stored within a single file (the second link has downloadable source-code for utilities that manipulate alternate data streams, if you really want to get down in the weeds).
I wanted to see one of these alternate streams in action myself, and discovered that you can view a file's alternate streams by using the /R switch of the DIR command. Here is DBCC CHECKDB in action, complete with a peek at the alternate steam in the file system.
I'm using the following command to provide directory listings for the AdventureWorks database:
This shows the AdventureWorks_Data.mdf file:
Now run dbcc checkdb('AdventureWorks') and, while that is still running, kick off the DIR command from a separate SSMS window. This shows the AdventureWorks_Data.mdf file and the alternate stream that is used for the internal database snapshot:
07 September 2010
Feeling the Love

06 September 2010
That's Virtually Twice as Fast

1. Main application launch2. GIS application launch -- almost 1 minute of 100% CPU -- OUCH!3. Network search4. Opening the first search result

03 September 2010
Chew Once, Swallow Twice
catch (Exception ex)
{
if (ex.Message.Contains("Violation of PRIMARY KEY" ))
{
//ok
}}
01 September 2010
What's in a name?
I took a quick peek at the data to see how the name lengths were distributed in each table. Both names had an average length in the mid- to upper-teens. Virtually none of the names were longer than 50 characters (probably why the bug went unnoticed for years).
Here are a couple visuals of the distribution:
Since this was a reasonably large sample (more than 100,000 names in each column), it probably makes a good guideline for full name column sizing.
As is usual with software defects, the standard “we inherited it” rule applies in this case. Which brings up the quick unrelated observation that I rarely meet developers who claim to write bugs, just folks who inherit them. I'll have to write more on that, later.
At any rate, it seems that bug writers like myself are so prolific that it doesn't take very many of us to keep all the real developers busy.

