low speed with mysql ?
| From: | Oliver Heering | Date: | Tue, 20 Jul 1999 20:22:32 +0000 |
| Subject: | low speed with mysql ? | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-2350@lists.php.net to get a copy of this message | ||
Hi,
I've just installed php 4.0beta1 on my apache 1.3.6 machine and I
discovered 2 problems:
1.
I had to add "-Wl,-rpath,/usr/local/mysql/lib/mysql" to the
"LIBS="-line in the file
"..../apache_1.3.6/src/modules/php4/libphp4.module". Otherwise Apache
would not compile because it cannot find the libmysqlclient.so.6 in
the mysql libs-dir. Does anyone know why? (btw: i have a SuSE Linux
6.0 with a self-compiled MySQL 3.22.23b in /usr/local/mysql.)
2.
A script uses a not really optimized function to get some data from
this MySQL-database. PHP 3.0.11 takes about 1-2 seconds where PHP
4.0B1 takes over 4 seconds to do the job. Why is it so slow? The
function that I think takes the most CPU-time does the following:
$result = mysql_query("SELECT team1 FROM matches GROUP BY team1");
while ($match = mysql_fetch_object($result)) $a[] = $match->team1;
$result = mysql_query("SELECT team2 FROM matches GROUP BY team2");
while ($match = mysql_fetch_object($result)) {
if (!arraycontains($a, $match->team2)) $a[] = $match->team2;
}
sort($a);
return $a;
Ok ok, it is really not optimized, but it's definitely a LOT faster
with PHP 3.0.11. :/
/-------------------------------------------------------------------\
| page: http://www.ocrana.de | | _ \
|
| | __| | _ \ | | |
| mail: sLoP@ocrana.de | \__ \ | ( | ___/ |
| cya | ____/_____|\___/ _| |
\-------------------------------------------------------------------/