I have:
I connect my linux server with database with unixODBC 2.3.1 and FREETDS 0.9.1
The connection is okay but the queries are slow. Here is my code that generate the image below:
$this->adodb->LogSQL(true); // turn on logging
$query = "select c.name, t.name, c.length from syscolumns c join systypes t on t.xusertype = c.xusertype
join sysobjects o on o.id=c.id where o.name = 'CONDOMINIO'";
$res = $this->adodb->Execute($query);
$this->adodb->LogSQL(false); // turn off logging
$perf = NewPerfMonitor($this->adodb);
echo $perf->SuspiciousSQL();
echo $perf->ExpensiveSQL();
Image http://www.vigoonline.net/slow.png
As you can see, the first query has an average time of 4.68 seconds, which is way too slow.
If I execute the same query like this:
$this->adodb->_query($query);
Then the time to execute the query takes less than a second what is great. Has anyone else experienced the same thing?
The query called with "Execute" is used for the own class for bringing the "MetaColumns" information from the table
The table "CONDOMINIO" only has 21 rows.
If the server database is in the same machine with the application script, then the response is fast!
I resolved this myself. Here is what I did:
Go to the file /adodb/drivers/adodb-odbc.inc.php
and to the class ADODB_odbc
Here try to find:
var $curmode = SQL_CUR_USE_DRIVER
and change it to:
var $curmode = SQL_CUR_USE_IF_NEEDED;
This will make the connection use SQL_CUR_USE_ODBC
when needed and "Voila" DB access speed to SQL server is really fast!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.