in reply to dbh->disconnect or leave to scope
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: dbh->disconnect or leave to scope
by Cagao (Monk) on Jan 18, 2011 at 14:05 UTC | |
by Tux (Canon) on Jan 19, 2011 at 07:57 UTC | |
by mje (Curate) on Jan 19, 2011 at 09:15 UTC | |
|
Re^2: dbh->disconnect or leave to scope
by Anonymous Monk on Jan 20, 2011 at 00:15 UTC |