[Techtalk] PHP / MySql and fat queries

Conor Daly c.daly at met.ie
Tue Feb 8 01:11:43 EST 2005

On Mon, Feb 07, 2005 at 02:32:42PM +0100 or thereabouts, kproot at nerim.net wrote:
> Hello,
>    I am in charge of maintaining a web app at work and those days the
> MySql queries have become huge. This was no problem on my test server
> as everything is local, I was getting results in seconds, but on the
> production server it turned out unusable. The main search form of the
> app cannot be used anymore, unless you choose a lot of criterias so
> there will not be too many results. If you don't, you don't get
> anything. I checked the html output and it just stops where the results
> should begin to appear - it's like something is dying there as I don't
> see the end of the output (like </body></html>).
>    So, does anyone know what exactly is happening, and if there is an
> option somewhere to avoid this? (like a numeric value of max rows to be
> returned by mysql, or whatever...)

There is a 'limit <number>' mysql keyword which should limit the number of
returned rows.  I saw it being used by phpMyAdmin and know no more about it.
It may reduce the time taken to return.  There are also timeout values which
can be set in /etc/php.ini such as 'max_execution_time' which might be
affecting your output.  If you turn on display of errors in /etc/php.ini you
might get something more informative back.  Note it is considered poor
security practice to leave error display on since it informs the user of
your server layout so you should turn it off once the problem is solved.

Conor Daly,                   Please avoid sending me 
Met Eireann, Glasnevin Hill,  Word or PowerPoint attachments.
Dublin 9, Ireland             http://www.fsf.org/philosophy/no-word-attachments.html
Ph +3531 8064276 Fax +3531 8064247

This e-mail and any files transmitted with it are confidential 
and intended solely for the addressee. If you have received
this email in error please notify the sender.
This e-mail message has also been scanned for the
presence of computer viruses.

More information about the Techtalk mailing list