June 16, 2003 at 1:43 am
Hi,
It seems that most people consider Cursors to be inefficient and to be avoided. I have a few instances where Cursors are needed but, in my case, they are always select less than 100 rows, are never updated and I only pass through the result set first to last.
Would I get a performance benefit from making them all Static and Read Only?
Cheers, Peter
June 16, 2003 at 3:42 am
It depends. Cursors are notroious for being used where not actually needed, but generally this is because the better solution is not seen. Look at you code and consider what it does and see if you can think of what might do the same thing without a cursor (even if it mens using temp tables). But if you cannot think of anything post your code, what the data looks like to begin with and what your expected output fro, the example data would be and someone will generally take a stab at it.
June 17, 2003 at 10:44 am
If you are stuck with having to use a cursor, then making them read only and static should help. You would have to test it for your situation, but I have had luck in the past with static cursors. Sometimes I have realized performance gains that were as much as 50 times faster. Generally it would be more efficient using batches though.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply