Solved

How decrease the sp_cursorfetch ??

Posted on 2007-11-28
3
1,029 Views
Last Modified: 2011-09-20
Hi,
I have written an application in ASP (with ADO) and an SQL server DB, but the performance is not good. I did run a trace in the SQL-profiler and the first 840 lines are covered with executions of the sp_cursorfetch, sp_cursoroption and sp_cursor stored procedures.

I don't know what causes these problems and I don't know how to solve them. Can someone help me on this?

Kind regards,
K.

PS: I use sometimes filters on recordsets in my ASP code. Is this okay?
0
Comment
Question by:claesk
3 Comments
 
LVL 23

Accepted Solution

by:
Ashish Patel earned 200 total points
ID: 20365002
Its always about the select statements which are using in cursor fetching, so you will have to imporve you indexes on the table where the select statements are used upon and the indexes should be applied mainly on the columns which are frequently used in where clause of the select statemetn.
0
 
LVL 11

Expert Comment

by:Otana
ID: 20365017
If I remember correctly, because you work with recordsets, you get a lot of cursor related commands. The use of cursors slows the system down significantly. To avoid this, you could try moving most of your calculations, record handling, whetever... to a stored procedure (without cursors) on your SQL Server, and then execute the stored procedure by calling it from your ASP code.
0
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 20369566
Those calls comes from working with a recordset that is connected to the server with a server cursor. This happens when you open a recordset that is capable of doing more than you need it to.

If a recordset only reads from the database, you should make sure that it's opened in "firehose" mode, or read-only, forward-only mode.

This is the default mode of a recordset, so you have to have some code that specifies a different mode.

For example, if you have:

objRecset.Open strSQL, objConnection, 3, 3

you just change it to:

objRecset.Open strSQL, objConnection
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

Suggested Solutions

Title # Comments Views Activity
Run SQL Server Proc from Access 11 31
SQL - Copy data from one database to another 6 19
SQL View nearest date 5 36
abs operation in sql server 15 15
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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

777 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