473,769 Members | 4,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mdac 2.8 and sql 2005 cursor performace issue

Hello

I have a VB6 application using classic ado (MDAC 2.8) for connecting
ms sql 2000 server. Application uses a lot of server side cursors. Now
I want to switch to ms sql 2005 server but I have noticed very serious
performance problem. Sql profiler results of execution of following
commands:

declare @p1 int
set @p1=180150131
declare @p3 int
set @p3=1
declare @p4 int
set @p4=16388
declare @p5 int
set @p5=22221
exec sp_cursoropen @p1 output,N' Select ... from ... where .... order
by ...',@p3 output,@p4 output,@p5 output
select @p1, @p3, @p4, @p5

on sql server 2000:

CPU: 234
Reads: 82515
Writes: 136
Duration: 296

and on sql server 2005:

CPU: 4703
Reads: 678751
Writes: 1
Duration: 4867

Both databases are identical, the servers runs on the same machine
(Pentium 2,8 Ghz, 2 GB RAM) with only one client connected. On forums
I've read that Microsoft doesn't recommend using server side cursors
on sql 2005 but is there any way to increase performance to some
acceptable level?

thanks in advance

szymon strus

Jun 18 '07 #1
5 5350
(sz**********@g mail.com) writes:
Both databases are identical, the servers runs on the same machine
(Pentium 2,8 Ghz, 2 GB RAM) with only one client connected. On forums
I've read that Microsoft doesn't recommend using server side cursors
on sql 2005 but is there any way to increase performance to some
acceptable level?
Have you tried running the queries that spawns the cursors from a query
window to compare the results? It could be an issue with the query plan.
If the database was upgraded from SQL 2000, be sure that you run
sp_updatestats, as statistics are invalidated when you upgrade the database.

What style of cursors do you use? Dynamic, keyset, static or forward_only?

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 18 '07 #2
Have you tried running the queries that spawns the cursors from a query
window to compare the results? It could be an issue with the query plan.
If the database was upgraded from SQL 2000, be sure that you run
sp_updatestats, as statistics are invalidated when you upgrade the database.

What style of cursors do you use? Dynamic, keyset, static or forward_only?
Updating statistics didn't changed anything. Running the query from
the query analyzer takes about 5 seconds for both servers. Cursor from
my example is keyset-driven. Database Tuning Advisor for the specified
query created few indexes but it also hasn't speed up execution of
query.

Jun 19 '07 #3
(sz**********@g mail.com) writes:
Updating statistics didn't changed anything. Running the query from
the query analyzer takes about 5 seconds for both servers. Cursor from
my example is keyset-driven. Database Tuning Advisor for the specified
query created few indexes but it also hasn't speed up execution of
query.
Next step would be to try DECLARE CUSROR KEYSET from Query Analyzer on both
servers. The plan for a keyset or a dynamic cursor can be quite different
from the plan for a specific query.

Do you really need a keyset-driven cursor? Could a static cursor do?
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 19 '07 #4
On Jun 19, 12:29 pm, Erland Sommarskog <esq...@sommars kog.sewrote:
(szymon.st...@g mail.com) writes:
Updating statistics didn't changed anything. Running the query from
the query analyzer takes about 5 seconds for both servers. Cursor from
my example is keyset-driven. Database Tuning Advisor for the specified
query created few indexes but it also hasn't speed up execution of
query.

Next step would be to try DECLARE CUSROR KEYSET from Query Analyzer on both
servers. The plan for a keyset or a dynamic cursor can be quite different
from the plan for a specific query.
Hi

Below are duration times of execution following commands:

declare test_cursor cursor <cursor_type>

for Select ...

open test_cursor

fetch next from test_cursor

close test_cursor

deallocate test_cursor

------------------------------
SQL 2000

Dynamic 332
Static 4997
Keyset 263
Forward_only 359

------------------------------
SQL2005

Dynamic 297
Static 5286
Keyset 299
Forward_only 343

So as you can see for keyset driven cursor (which is the same as from
my example) the results are quite nice but it didn't solve the problem
with ADO :/ I'm afraid that the only solution is to use some other
data access technology :(

Jun 21 '07 #5
(sz**********@g mail.com) writes:
Below are duration times of execution following commands:

declare test_cursor cursor <cursor_type>
for Select ...
open test_cursor
fetch next from test_cursor
close test_cursor
deallocate test_cursor

------------------------------
SQL 2000

Dynamic 332
Static 4997
Keyset 263
Forward_only 359

------------------------------
SQL2005

Dynamic 297
Static 5286
Keyset 299
Forward_only 343
Interesting numbers. It's surprising to see STATIC to be so slow.
But I guess this is because all the data is copied to a worktable
in tempdb.

As I understand your example, you are only fetching one row, not
looping through the entire cursor. That could be different.

I need to confess that my poor experience with keyset-driven cursors
stems from SQL 6.5 where I regularly ran into performance problems
with the default type of cursor, which I resolved by adding
INSENSITIVE before CURSOR. I believe an insensitive cursor is the same
as a static cursor.
So as you can see for keyset driven cursor (which is the same as from
my example) the results are quite nice but it didn't solve the problem
with ADO :/ I'm afraid that the only solution is to use some other
data access technology :(
Well, ADO is a piece of crap if you ask me. But you probably get a
lot better performance if you use a client-side cursor. (Which is not
really a cursor at all, just a bunch of records in memory.)

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 21 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4345
by: ivy | last post by:
I have a problem lies with a meta tag. Below is my code: <!--METADATA TYPE="TypeLib" NAME="Microsoft ActiveX Data Objects 2.5 Library" UUID="{00000205-0000-0010-8000-00AA006D2EA4}" VERSION="2.5"--> This is suppose to set a reference to a MDAC file which will hold many constants. The error appears on the following line: oComp.AddParam "@UserID", adVarChar, adParamInput, 100, msUserID Error message. Microsoft VBScript runtime (0x800A01F4)...
2
3998
by: Zach Gastineau | last post by:
I'm having problems using the DB2 Connect ODBC Driver in my SQL Server 2000 DTS packages. It started occuring after installing MDAC 2.7 (which is necessary for the .NET framework). This error occurs when I try to open the transformation that uses an ODBC Connection object that is pointing to the DB2 ODBC. Has anybody else seen this or has a solution other than re-installing everything and not loading the .net framework mdac 2.7. I...
4
1584
by: Darryl Kerkeslager | last post by:
Okay, so the Jet support is no longer in MDAC as of a few years ago. This was not a problem previously, as MDAC 2.5 was included with Windows 2000. Now, however, Windows XP does not include MDAC 2.5. (Right so far?) So, if our IT people who are installing XP Pro on all new computers, decide that they do not want to allow Jet40SP3_Comp.exe to be installed, does that mean this statement will not work. period, end of story?
6
4316
by: MM | last post by:
If I have a web site using ASP 3.0 and MS Access and hosted on a server with MDAC 2.7/2.8 installed, does it make any difference whether the mdb is an Access 97 one or an Access 2000 one? I only have Access 97. The hosting company intimated that I should seriously consider converting the mdb to Access 2000. Could I do that with ADO? I have VB6. MM
2
473
by: bala | last post by:
hi gurus have a ms access front end application in window 2000 professional operating system. need to connect to MS SQL Server 2000. the frontend MS Access application is connected to the MS SQL Server 2000 database using ADO Connection Object and OLEDB Providers. in some machine it is successfully connecting but in some machines it is giving raise to the following error message (or something similar)
2
349
by: Terry | last post by:
I am getting the following message back from ASP.NET. MDAC 2.8 is installed as is .NET Framework 1.1 with SP and security updates on a Win 2K Server. For some reason .NET is not recognizing that MDAC 2.8 is installed. The application is pretty vanilla and is just executing SQL to a Microsoft SQL Server 2000 database. The app runs fin on other Win 2K Servers and XP. Anyone run into this and can help us out? Terry Error that we are...
2
2020
by: John | last post by:
Hi, Please if you can read and help me in this questions, as I am beginner in programming. I am using ADO connection to MS Access database (DAO is not an option) in VB.NET 2005 project and I have to setup deployment of program. 1. Do you reccomend installation of MDAC 2.8 on user computer? What is gain in term with lets say ADO 2.6, or 2.7 version? 2. If other program uses MDAC 2.6 and I install MDAC 2.8, will I crush connection to...
19
2281
by: Tony Johansson | last post by:
Hello!! Which have best performance between i++ or ++i. Is it exact the same or is it some very small difference in performace betwwwn these two. //Tony
1
1369
by: =?Utf-8?B?Y25pY2ts?= | last post by:
i'm using VS 2005 / C# / WinXP pro SP2 / .NET Framework 2.0 I'm dealing with a problem I just can't figure out. I have a MDI application with two different types on Child windows. As means of data transfer between the Child windows I implemented a Drag And Drop like functionality. Part of that is that the cursor changes to different icons depending of what type of Child window it is hovering over. As long as I start the debug or release...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.