ODBC (mssql) fetches results really slow



{This is a repost from comp.databases.ms-sqlserver)

Hi group,

In my current project I have a performance problem.
I hope somebody can help with it.

- MSSQL 2005 server
- PHP5/IIS running over ADOBD abstractionlayer. (using DNS-less odbc_mssql)

global $ADODB_COUNTRECS;
$ADODB_COUNTRECS = false;
$connection = &ADONewConnection('odbc_mssql');
// $connection->debug = true;
$dsn = "Driver={SQL Server};Server=$server;Database=$dbdatabasename;";
$connection->Connect($dsn,$dbusername,$dbpassword);


I pinpointed the bottleneck as follows:
1) A certain QueryX takes > 60 seconds to complete from my application.
2) That same queryX takes 2 seconds to complete when executed in SQL Server Management Studio.
3) By adding timestamps into my code I found out that all the time is consumed by fetching the resultset into PHP/IIS.

For reasons beyound my control I cannot switch to the native driver.
(I did some tests with it, and the result came in bloody fast when using native drivers, but other parts of the application give trouble when using it, and there is no money for a complete overhaul.)

I am no ODBC expert, but I tried to catch up a little by reading on the web. I have the impression my slow performance is caused by the fact that ODBC fetches each record one by one.
Is that correct?

The following article seems to say that 'SQL_ROWSET_SIZE 1' is default.
http://msdn.microsoft.com/en-us/library/ms811006.aspx
Does that mean I can change it to a higher number and get better results?

My question: Is there some way to make ODBC fetch all records faster?
I have no need of fancy cursors (like DYNAMIC), I just want the records returned from my query faster.


Thanks for your time.

Regards,
Erwin Moller

.



Relevant Pages

  • ODBC / mssql very slow
    ... In my current project I have a performance problem. ... That same queryX takes 2 seconds to complete when executed in SQL Server Management Studio. ... I have the impression my slow performance is caused by the fact that ODBC fetches each record one by one. ... "There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. ...
    (comp.databases.ms-sqlserver)
  • Re: Alternative to using DSN to connect to database
    ... you have to use .NET ODBC provider. ... Server is NOT optimized. ... Just because of the Admiistrator thinking DSN is easier for him to control ... > Basically my problem is that the ODBC Connection Manager in Control Panel ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: SQL Server extremely slow
    ... terms of what is meant by a dis-connected ado recordset. ... table in a mdb file could be considered disconnected from the server ... Well, ok, but keep in mind the disk drive is on sql server! ... 10 reocrds from the server via odbc does not produce more ...
    (comp.databases.ms-access)
  • Re: Need ODBC for every front end, or just server?
    ... on the server, and, in response to some other signal ... > to use the ODBC driver is on the workstation, ... >> Do I need the ODBC license and install on every Front End PC, ...
    (microsoft.public.access.externaldata)
  • Linked Servers: Invalid schema
    ... Have you put a trace on the ODBC ... call 'in query analyser)- that gets ... database you are trying to connect to and schema refers to ... >server in Enterprise Manager and I have also used it ...
    (microsoft.public.sqlserver.odbc)

Loading