Solved

How decrease the sp_cursorfetch ??

Posted on 2007-11-28
3
1,045 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

695 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