Re: Number of Connections

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Neil Conway <nconway@klamath.dyndns.org>
Cc: pgsql-general <pgsql-general@postgresql.org>
Date: 2001-02-16T21:23:57Z
Lists: pgsql-general
Neil Conway <nconway@klamath.dyndns.org> writes:
> On Fri, Feb 16, 2001 at 02:09:42PM -0500, Bryan White wrote:
>> ps ax | grep postgres | wc -l
>> Note the value is often one to high because is picks up the grep process.

> Why not just remove 'grep' - i.e
> ps ax | grep postgres | grep -v grep | wc -l

Actually this is a standard problem with a standard solution: use a
not-so-literal grep pattern, eg

	ps ax | grep '[p]ostgres' | wc -l

This pattern matches 'postgres' but not '[p]ostgres'.  Problem solved.

			regards, tom lane