PRO: Designing and Optimizing Data Access by Using Microsoft SQL Server 2005
Design appropriate data access technologies.
Design an appropriate data access object model.
Design a cursor strategy for a data access component.
- Decide when to use cursors.
- Decide how to maximize cursor performance.
- Detect which applications are using cursors and evaluate whether to remove them.
I just looked at my testing schedule and realized I'm taking this test in two days. Time to get cramming...
The first two items are kind of vague. I don't think there's much to be said there.
My cursor strategy is... don't use them. However it appears there are times when it is faster. Andy Machanic has found that they solve the running sum problem much faster than traditional relational methods. However he found using CLR worked much better.
Maximizing performance would be centered around opening it as FAST_FORWARD.
There's a couple of ways that I can think of to detect whether or not an "app" is using cursors. You can scan through the system tables(sys.procedure) looking for the word OPEN CURSOR. That won't work if a) the stored procs are encrypted, b) the stored procs utilize CLR, or c) the app uses dynamic SQL. The best option would be to profile the database, looking for cursor events.