Tuesday, February 28, 2006

The Cursor is Dead! Long Live the Cursor!

Adam Machanic is one of my favorite MVPs - I like his books, he's always willing to help in the newsgroups, he speaks well at the conferences, and when he has an opinion, I pay attention.

SQL Server 2005 Bible will have a chapter called "Kill the Cursor!" that works through a complex logic problem and solves it 7 different ways - 4 cursors and 3 set-based solutions. For complex logic, set-based solutions rule; but not so for cumulative totals.

In some text for a future publication, a tech reviewer disagreed with me when I said that cumulative totals (running sums) were best done with a cursor. The tech reviewer listed what appears to be an elegant correlated subquery that does in fact do running sums. The assumption was that set-based was always faster than a cursor.

Adam was on the thread and volunteered to run the tests...
Adam's Blog

Sunday, February 26, 2006

SQL Down Under

At the European PASS Conference last week in Barcelona I sat in on Greg Low's session on Avoiding Recompiles in SQL Server 2005. Greg is the host of SQL Down Under and true SQL Server guru.

One of the key enhancements in SQL Server 2005 is statement level recompiles. I wrote about this in my TechNet article. Greg made the observation that with SQL Server 2005 you may see more recompiles but each recompile is much cheaper. He demonstrated recompiles and missed cache hits using SQL Profiler and explained in detail what causes recompiles and cache misses.

If you haven't listened to Greg Low and his SQL Down Under net radio show - I invite you to take the time to enjoy Greg and his guests. Ausie Ausie Ausie Oy Oy Oy!

Thursday, February 23, 2006


I'm here in Barcelona for the PASS European Conference. The city is wonderful - full of Gaudi architecture and easy to navigate. My wife, Edie, has been exploring the city while I'm at the conference. I enjoy hearing the mixture of the languages and meeting folks from all over Europe.

The PSS Boot Camp pre-con day had deep presentations by Ken Henderson, Bart Duncan, and Bob Ward. I especially enjoyed Bart's session on Query Optimization. Tomorrow morning I'm presenting What's New in T-SQL.

On an edible note, the profteroles at Il Golfo di Napoli are a light cream pastry covered in melted chocolate. Amazing. The best desert we've had in Barcelona - right around the corner from the conference hotel. We held our Board dinner at Los Caracoles in the Gothic quarter - very cool resturant!