Ping database on regular interval

[quote]
I can see the attraction, the connection is always there, just hit the database. No opening/closing the connection every time has to be quicker right? Yep, you save yourself a very small hit - great - but there’s a trade off at the database end. Every DBA I’ve ever met winces at the idea, it’s ugly and brings it’s own problems. These are your apps, do it if you like - I’m not here to argue.[/quote]

All I’m saying is that it is doable, if the code on the client is not too dumb.

I noticed one other thing (at least with Postgres), it takes a few seconds (maybe 15 or 20) to drop the connection - so, if you call db.close and then within the next few seconds execute another query, the connection remains open (and there is no lag). So, you kind of get the best of both worlds - you can be closing the connection regularly, but benefit from it remaining open if you are diligently reading or entering data.

We use the bouncer here for DB polling

http://pgbouncer.projects.pgfoundry.org/

Just because something is doable doesn’t mean it’s smart coding :slight_smile: Anyhow, I’m out of this conversation!