NYCPHP Meetup

NYPHP.org

[nycphp-talk] Long MySQL processes, connections

Hans Zaunere lists at zaunere.com
Mon Oct 24 12:20:31 EDT 2005



Matt Roberts wrote on Saturday, October 22, 2005 4:15 PM:
> I'm using mysql_connect() to access a MySQL database at the beginning
> of a PHP script.
> 
> This script does long process of a large recordset, and generally
> takes 30-40 minutes to process all records.
> 
> My question: what's the best way to handle this long connection?
> Could someone please explain the behind the scenes / best practice
> around MySQL var "wait_timeout" ?  Sometimes the process hangs -
> could it be related to this timeout variable?  As a workaround I
> connect and disconnect at the top and bottom of the processing loop -
> is this a bad idea?

I'd need more details to truly diagnose this (or even determine if there's
something wrong).  That said, wait_timeout isn't likely playing a role here.
It controls the timeout for inactive/idle connections.

The process hangs could be from a number of things, including hardware
limitations, large tasks during the course of normal processing, contension,
etc.  Again, without knowing what type of processing is being done, it's not
easy to determine what the problem is, and frankly, if there is even a
problem at all.  Depending on how many rows you're dealing with, the
timeframe might be ok.


---
Hans Zaunere / President / New York PHP
   www.nyphp.org  /  www.nyphp.com






More information about the talk mailing list