Advertisement

07.12.2007 at 10:26PM PDT, ID: 22693796
[x]
Attachment Details

PHP Informix query taking too long to execute

Asked by COS_IT_AU in Informix Database, Apache Web Server, PHP and Databases

Tags: query, php, long, informix, too

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_AUStart Free Trial
[+][-]07.12.2007 at 10:30PM PDT, ID: 19478413

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.12.2007 at 11:04PM PDT, ID: 19478530

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.12.2007 at 11:16PM PDT, ID: 19478559

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.12.2007 at 11:54PM PDT, ID: 19478665

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.13.2007 at 12:32AM PDT, ID: 19478748

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2007 at 08:41AM PDT, ID: 19490685

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Informix Database, Apache Web Server, PHP and Databases
Tags: query, php, long, informix, too
Sign Up Now!
Solution Provided By: giltjr
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32