Solved

How decrease the sp_cursorfetch ??

Posted on 2007-11-28
3
1,020 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now