OT: MySQL Open/Close question

stephen barncard stephenREVOLUTION2 at barncard.com
Fri May 29 14:33:45 EDT 2009


I've been both working with MySQL and on this list for some time but never
asked about this:
How much overhead is involved with opening and closing a MySQL connection?
 Before I run some benchmarks I'd like to get other opinions.

For instance, in an app I have a recursive handler than may make upwards of
66 queries in rapid succession. Each query depends on the previous query for
the next. I want to see this information returned as soon as possible.

At this time I just try to keep the connection open with a ping every few
minutes. This works well on my machine, but working with a MySQL server on
the net tends to disconnect, even though the timeout at the server is set to
a high number.

If I would open and close the connection for each of the rapid queries,
isn't that generating more work for the server? Or does it really matter?

What's the 'best' way of dealing with opening / closing' in MySQL?

thanks
-------------------------
Stephen Barncard
Swervedriver Fan
San Francisco
http://barncard.com



More information about the use-livecode mailing list