Dne 25.6.2011 13:22, Alban Hertroys napsal(a):
> As another possible improvement, I'd probably not create a new connection in every function call, but use a global $db object instead. Creating DB-connections is relatively expensive, so you don't want to do that more often than strictly necessary. In that case you could probably use beginTransaction at the start of your script and commit at the end.
Not really - he already uses a pgbouncer. Sure, obtaining a connection
from pgbouncer still an overhead, but much smaller than creating a true
pg connection.
But you're right it's a bad programming habbit, and the connection
should be closed at the end.
regards
Tomas