|go ahead... be a heretic|
Re: dbh->disconnect or leave to scopeby FloydATC (Chaplain)
|on Jan 18, 2011 at 13:05 UTC||Need Help??|
Why not just disconnect it?
You probably know exactly when you're done with it, otherwise you may need to re-examine your design. Keeping the connection open longer than you need it is a waste of resources somewhere, somehow.
For long-running programs it can be tempting to just "keep it around" but unless your design requires that you hammer the server with a constant stream of queries it's probably better to make your conversations with the server short and to the point.
Establishing a new TCP connection with MySQL isn't that expensive, unless we're talking about thousands of connections per second I doubt that's where your bottleneck will be.
...that's my personal opinion anyway.
-- Time flies when you don't know what you're doing