This is probably either an Apache configuration or PHP configuration or PHP code question.
I am running PHP Version 5.2.0 on Apache 2.0 (Red Hat Linux RHEL v4) and running queries against an Informix SE database.
When I run a simple sql statement, i.e.
$sql = "select col1, col2, col3 from tablex where blah...";
$result = ifx_query($sql, $dbh);
while ($row = ifx_fetch_row($result) {
...
...
}
and it returns 500,000 records.
In PHP on the Apache websever its takes 40 seconds to execute, where as when I run the exact query in a windows query tool such as AQT on my PC through ODBCS, it takes 3 seconds.
Why such a big difference in execution time? Is it because of webserver overheads such as data transferred from database to webserver, webserver saves data in ram, webserver returns ram data to PHP???
I've tried the above on various different queries with the same consistent result. My query always executes sustantially faster than the webserver. Both my computer and webserver in the same LAN. Is there a faster way of executing queries on the webserver?
I have tried IFX_SCROLL with no improvement, there are PHP coding I can use? Or PHP setting? Or Apache setting?
$sql = "select col1, col2, col3 from tablex where blah...";
$result = ifx_query($sql, $dbh, IFX_SCROLL);
while ($row = ifx_fetch_row($result, "NEXT") {
...
...
}
Thanks in Advance.
Cheers,
COS_IT_AU
Start Free Trial