Optimizing for Ad hoc Workloads

One of the nifty features available in SQL Server 2008 is the "Optimize for Ad hoc Workloads" option, which is at the instance level.  If your workload involves a high number of ad hoc queries that are used only once, your plan cache (also known as the "procedure cache") may benefit from enabling this feature.  (There are, of course, other solutions to this issue as well, a primary one being to use less ad-hoc SQL and more stored procedures, but that may not always be possible.) What it does SQL Server has an upper limit on the size of its…
Read More

Transactions: Taking The Plunge

A few days ago Tim Ford (blog | twitter) put forth a challenge to describe a transaction in a non-technical fashion.  I could have replied to the post directly, but I figured it would be rather wordy.  Instead I decided to follow the lead of Janice Lee (blog | twitter) and write a post about it, providing Tim with a neat and tidy hyperlink instead. One thought I had is that committing a transaction is like jumping off a diving board. It's Atomic, meaning it happens or it doesn't, there is no in-between.  If you jump off the board, you'll…
Read More

More Than An Output

No more than an output to me, but it sure was to SQL Server!  This issue kept me busy over the weekend, and most definitely gave me a case of Saturday Night SQL Fever (as opposed to "SQL Saturday Night Fever", for which the only cure is more karaoke). When executing a stored procedure with an OUTPUT parameter, I always believed that the pre-execution state of a variable being written to by the output parameter didn’t matter, as it would be overwritten. A quick poll on Twitter showed me that I’m not alone, however I recently discovered this isn’t always…
Read More

T-SQL Tuesday #007: My Favorite 2008 Feature

This post is my contribution to T-SQL Tuesday #007, hosted this month by the SQLChicken himself, Jorge Segarra (Blog | Twitter). Since I'm a bad DBA and have yet to get my hands on a copy of R2, I'll make use of the rule that we can discuss any feature from 2008.  My favorite is filtered indexes, as they were the solution to an issue I had been trying to fix for 5 years. The Background In a former life, I spent several years working as a building inspector for one of Chicago's western suburbs.  It quickly became evident that…
Read More

Tips for Upgrading SQL Server Versions

At my previous employer I took part in several projects that involved migrating databases not only to new hardware but also to new versions of SQL Server.  We upgraded machines running the 2000 and 2005 versions of SQL Server to 2008.  Here's how we went about doing it, and some helpful hints we figured out along the way. Disclaimers I'm fully aware there are lots of ways to migrate hardware and data between machines and database versions, I'll just be talking about the way we did it.  We were fortunate enough to not have to worry about downtime, as this…
Read More