Thread

  1. Number of Connections

    Steve McAtee <steve@proactivedev.com> — 2001-02-14T16:37:25Z

    Hello,
    
    I'm a bit new to postgres.  Is there anyway to tell the current number of
    connections on a database or server?  I'm having a connection closing
    problem and would like to debug it somehow.  I know on Sybase you can check
    a sys table to determine this.  Not familiar with how to do this on
    Postgres.
    
    Please advise and thank you.
    
    
    
    
  2. Re: Number of Connections

    Bryan White <bryan@arcamax.com> — 2001-02-16T19:09:42Z

    
    > Hello,
    >
    > I'm a bit new to postgres.  Is there anyway to tell the current number of
    > connections on a database or server?  I'm having a connection closing
    > problem and would like to debug it somehow.  I know on Sybase you can
    check
    > a sys table to determine this.  Not familiar with how to do this on
    > Postgres.
    
    I use:
        ps ax | grep postgres | wc -l
    Note the value is often one to high because is picks up the grep process.
    
    Use
        ps ax | grep postgres
    to look at the processes and see what IP are connected, what users, and what
    the backend is doing (IDLE, SELECT, ..)
    
    
    
    
  3. Re: Number of Connections

    Neil Conway <nconway@klamath.dyndns.org> — 2001-02-16T20:05:50Z

    On Fri, Feb 16, 2001 at 02:09:42PM -0500, Bryan White wrote:
    > I use:
    >     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
    
    HTH,
    
    Neil
    
    -- 
    Neil Conway <neilconway@home.com>
    Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc
    Encrypted mail welcomed
    
    Four stages of acceptance:
        i) this is worthless nonsense;
        ii) this is an interesting, but perverse, point of view;
        iii) this is true, but quite unimportant;
        iv) I always said so. 
            -- J. B. S. Haldane in Journal of Genetics 58:464 (1963).
    
    
  4. Re: Number of Connections

    Tom Lane <tgl@sss.pgh.pa.us> — 2001-02-16T21:23:57Z

    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
    
    
  5. Re: Number of Connections

    Tim Barnard <tbarnard@povn.com> — 2001-02-16T21:56:37Z

    What's the purpose of the "grep -v grep" ?
    
    Tim
    
    ----- Original Message -----
    From: "Neil Conway" <nconway@klamath.dyndns.org>
    To: "pgsql-general" <pgsql-general@postgreSQL.org>
    Sent: Friday, February 16, 2001 12:05 PM
    Subject: Re: [GENERAL] Number of Connections
    
    
    > On Fri, Feb 16, 2001 at 02:09:42PM -0500, Bryan White wrote:
    > > I use:
    > >     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
    >
    > HTH,
    >
    > Neil
    >
    > --
    > Neil Conway <neilconway@home.com>
    > Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc
    > Encrypted mail welcomed
    
    
    
    
  6. Re: Number of Connections

    Brett W. McCoy <bmccoy@chapelperilous.net> — 2001-02-16T22:34:38Z

    On Fri, 16 Feb 2001, Tim Barnard wrote:
    
    > What's the purpose of the "grep -v grep" ?
    
    It ignores listing of grep in the output stream.
    
    -- Brett
                                         http://www.chapelperilous.net/~bmccoy/
    ---------------------------------------------------------------------------
    Q:	What do agnostic, insomniac dyslexics do at night?
    A:	Stay awake and wonder if there's a dog.
    
    
    
  7. Re: Number of Connections

    John Burski <john.burski@911ep.com> — 2001-02-16T22:47:46Z

    The "-v" option tells grep to select everything EXCEPT the following
    term.  Therefore, the "grep -v grep" section of the piped commands will
    delete the "extra" line (the one generated by the "grep postgres"
    command) that the ps command spits out prior to piping it into the "wc
    -l" command.
    
    Tim Barnard wrote:
    
    > What's the purpose of the "grep -v grep" ?
    >
    > Tim
    >
    > ----- Original Message -----
    > From: "Neil Conway" <nconway@klamath.dyndns.org>
    > To: "pgsql-general" <pgsql-general@postgreSQL.org>
    > Sent: Friday, February 16, 2001 12:05 PM
    > Subject: Re: [GENERAL] Number of Connections
    >
    > > On Fri, Feb 16, 2001 at 02:09:42PM -0500, Bryan White wrote:
    > > > I use:
    > > >     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
    > >
    > > HTH,
    > >
    > > Neil
    > >
    > > --
    > > Neil Conway <neilconway@home.com>
    > > Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc
    > > Encrypted mail welcomed
    
    --
    John Burski
    Chief IT Cook and Bottlewasher
    911 Emergency Products, St. Cloud, MN
    (320) 656 0076       www.911ep.com
    
    ++++++++++++++++++++++++++++++++++
    + How's your cheese holding out? +
    ++++++++++++++++++++++++++++++++++
    
    
    
    
    
  8. Re: Number of Connections

    Tim Barnard <tbarnard@povn.com> — 2001-02-17T00:22:33Z

    Thanks.
    
    Tim
    
    ----- Original Message ----- 
    From: "John Burski" <John.Burski@911ep.com>
    To: "Tim Barnard" <tbarnard@povn.com>
    Cc: "pgsql-general" <pgsql-general@postgresql.org>
    Sent: Friday, February 16, 2001 2:47 PM
    Subject: Re: [GENERAL] Number of Connections
    
    
    > The "-v" option tells grep to select everything EXCEPT the following
    > term.  Therefore, the "grep -v grep" section of the piped commands will
    > delete the "extra" line (the one generated by the "grep postgres"
    > command) that the ps command spits out prior to piping it into the "wc
    > -l" command.
    > 
    > Tim Barnard wrote:
    > 
    > > What's the purpose of the "grep -v grep" ?
    > >
    > > Tim
    > >