Re: Detecting backend failures via libpq / DBD::Pg - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: Detecting backend failures via libpq / DBD::Pg
Date
Msg-id 54A20641.5020706@BlueTreble.com
Whole thread Raw
In response to Detecting backend failures via libpq / DBD::Pg  ("Greg Sabino Mullane" <greg@turnstep.com>)
List pgsql-hackers
On 12/29/14, 6:43 PM, Greg Sabino Mullane wrote:
> I am working on enhancing the ping() method of DBD::Pg. The goal of that
> is for a user to be able to determine if the connection to the database
> is still valid.

This is actually a VERY common thing for monitoring frameworks to do. Currently, the general method seems to be
somethingakin to
 

psql -c 'SELECT 1' ...

perhaps instead of going through all the effort that you currently are we could add a FEBE ping command, and expose
thatthrough a special psql option (or maybe a special pg_ping command).
 

This won't be noticeably faster than SELECT 1, but it would prevent a bunch of pointless work on the backend side, and
shouldgreatly simplify DBD's ping(). Only thing I'm not sure of is if this could be made to be safe within a COPY...
:(
-- 
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: nls and server log
Next
From: Jim Nasby
Date:
Subject: Re: Additional role attributes && superuser review