Solved

Performance Procedure

Posted on 2013-01-26
6
232 Views
Last Modified: 2013-01-27
I can win performance on sql server stored procedure. I need use cursor with fast_forward or while @@rowcount>0 i improve most performance?
0
Comment
Question by:fsouza
6 Comments
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 38823126
A cursor is usually the slowest way to do anything. Can you please post what you are trying to do?
0
 
LVL 5

Expert Comment

by:RehanYousaf
ID: 38823306
It depends on the situation ... I mostly try to avoid both ... If you explain what you want maybe we can help

P.S. Performance matters if you dealing with large amounts of data
0
 
LVL 6

Accepted Solution

by:
esolve earned 250 total points
ID: 38823540
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:fsouza
ID: 38824177
The correct use is CURSOR LOCAL FAST_FORWARD or CURSOR FAST_FORWARD ???
0
 
LVL 5

Expert Comment

by:RehanYousaf
ID: 38824313
correct use is to avoid both ... atleast read those articles before asking same question again...
it all depends on your scenario which you havent told us yet :-)
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 250 total points
ID: 38824321
The correct use is CURSOR LOCAL FAST_FORWARD or CURSOR FAST_FORWARD ???
If I understand you correctly the question is:

What is the difference between using the keyword LOCAL and not using it?

The answer is nothing.  They are the same.

Here is the definition from SQL Server's BOL (my emphasis):
LOCAL
Specifies that the scope of the cursor is local to the batch, stored procedure, or trigger in which the cursor was created. The cursor name is only valid within this scope. The cursor can be referenced by local cursor variables in the batch, stored procedure, or trigger, or a stored procedure OUTPUT parameter. An OUTPUT parameter is used to pass the local cursor back to the calling batch, stored procedure, or trigger, which can assign the parameter to a cursor variable to reference the cursor after the stored procedure terminates. The cursor is implicitly deallocated when the batch, stored procedure, or trigger terminates, unless the cursor was passed back in an OUTPUT parameter. If it is passed back in an OUTPUT parameter, the cursor is deallocated when the last variable referencing it is deallocated or goes out of scope.

GLOBAL
Specifies that the scope of the cursor is global to the connection. The cursor name can be referenced in any stored procedure or batch executed by the connection. The cursor is only implicitly deallocated at disconnect.

Note:  
If neither GLOBAL or LOCAL is specified, the default is controlled by the setting of the default to local cursor database option. In SQL Server version 7.0, this option defaults to FALSE to match earlier  
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question