Well, I'm not being familiar with your code, I can only offer this one suggestion...
If you are opening the connection to the database with pg_connect, when the script is through, it usually automatically closes the connection. You might want to move over to pg_pconnect to obtain a persistent connection. An added benefit from using pg_pconnect is that you shouldn't have to pass around your object. According to the manual, if you use pg_pconnect a second time with the same parameters (which I'm sure your class calls it the same why each time), it will not open up a new connection, but use the existing one...
Hope that info helps,
Matt Wade
codewalkers.com