Creating faster cursors in SQL Server

Using SQL Server cursors can be slow. However there is a way to speed them up.

This tip was submitted to the SearchWin2000.com tip exchange by member Gilbert Segal. Please let other users know how useful it is by rating it below.


Using SQL Server cursors can be slow. However there is a way to speed them up. If you don't need to use all of the columns in a table, consider putting in only the columns you need in the SELECT statement. Instead of using "SELECT * ," use "SELECT col1,col2,etc."

I put in 20 columns in a query instead of using "*" and having it use all 95 columns. The cursor ran six times faster.

This was first published in March 2005

Dig deeper on Microsoft SQL Server Performance Monitoring and Tuning

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close