• Heh... I used to seriously question cursors… now, I LOVE cursors and RBAR While Loops, too! Even better than that, I LOVE code that looks set-based (no While loops) that actually has performance worse than cursors (usually some wonderful form of triangular join associated with a correlated sub-query). They're all really sweet deals and my friends that sell hardware get about 80% of their repeat business from folks that have performance issues and throw hardware at the problem. The Developer's (in-house and 3rd party) are loving it, too. They know the users will throw hardware at the problem so no need for the Developer's to actually think about writing performance enabled code. They can just crank out oodles of code in a highly productive manner without having to even think about performance. What a deal! And there's even built in obsolescence! As the data grows, so does the need for even more performance... so, about every two years, the customers order more new hardware to fix their lovely performance problems, all without having to actually touch any working code and without ever having to call the customer to see how they're doing! Sweet, huh? And, what the Developers really like is the fact that they no longer have to spend any time justifying cursors to the DBA even for the simplest of tasks… the hardware will take care of it!

    The Systems DBA's are loving it, too! Long gone are the days when they have to review code for potential performance issues… they can just promote the code to production without even having to look at it. They know that it can all be handled with hardware! And, if a cursor is responsible for a deadlock, no problem!!! Just buy another server to run that process on!

    Management likes hardware solutions a lot because, as everyone knows… hardware is a lot cheaper than good programmers! And, it makes justifying the floor-plan, air-conditioning, cooling, and power consumption budgets so much easier! In fact, Management just loves being able to tell their golfing buddies about the nifty set of 8, 16, and 32 processor boxes they just got… saved oodles by being able to get Developer's at a quarter of the cost because they don't actually have to understand RDBMS's anymore and they have a lot more time to write the GUI code that they're so good at. And, with things like Hibernate, they don't even need to be good at that anymore, either… it'll automatically write the performance challenged code for them! That means even the interviewing process becomes a lot easier and cheaper because you don't need to hire DBA's that know much, either! The savings just don't quit!

    But, as much as I like cursors, you're all missing the holy grail of hardware justification… the very mention of it just sends hardware chills up and down my little data-troll spine in fevered anticipation… my hardware buddies are expecting hardware upgrades to triple or quadruple in just the next year or so because of it… AND, you can hire even cheaper programmers because the data just figures itself out... ya just gotta love XML for all the potential savings, don'cha?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)