Re: Detecting backend failures via libpq / DBD::Pg

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Detecting backend failures via libpq / DBD::Pg
Date: 2014-12-30 01:56:17
Message-ID: 54A20641.5020706@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 something akin 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 that through 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 should greatly 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2014-12-30 02:07:27 Re: Additional role attributes && superuser review
Previous Message Craig Ringer 2014-12-30 01:40:12 Re: nls and server log