Обсуждение: monitoring running queries?

Поиск
Список
Период
Сортировка

monitoring running queries?

От
Brice Ruth
Дата:
Is there any way (besides ps) to view queries that are running on the
PostgreSQL server?  Something that actually output the query being run
would be great.

--
Brice Ruth
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/

Re: monitoring running queries?

От
"Brett W. McCoy"
Дата:
On Wed, 7 Feb 2001, Brice Ruth wrote:

> Is there any way (besides ps) to view queries that are running on the
> PostgreSQL server?  Something that actually output the query being run
> would be great.

You can set the logging option for query to 4, I believe, and it will log
the full query by whatever logging facility you are using (syslog,
redirected stdout or whatever).  Take a look in the admin docs for
whatever version you are using.  There's a lot fo stuff you can log.

If you are logging queries, you can open up the log file with tail -f and
monitor the log as queries are being made.

-- Brett
                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
If you think the problem is bad now, just wait until we've solved it.
        -- Arthur Kasspe


Re: monitoring running queries?

От
Dirk Lutzebaeck
Дата:
Brett W. McCoy writes:
 > On Wed, 7 Feb 2001, Brice Ruth wrote:
 >
 > > Is there any way (besides ps) to view queries that are running on the
 > > PostgreSQL server?  Something that actually output the query being run
 > > would be great.
 >
 > You can set the logging option for query to 4, I believe, and it will log
 > the full query by whatever logging facility you are using (syslog,
 > redirected stdout or whatever).  Take a look in the admin docs for
 > whatever version you are using.  There's a lot fo stuff you can log.
 >
 > If you are logging queries, you can open up the log file with tail -f and
 > monitor the log as queries are being made.

would be nice if the debug/logging level could be changed with
SIGUSR1/2 like samba.

Dirk

Re: monitoring running queries?

От
Brice Ruth
Дата:
Its not working ... I looked at the admin docs and edited the pg_options
file appropriately ... the following is what appears in /var/log/messages:

postgres[23686]: read_pg_options: verbose=2,query=4,syslog=2

But no queries ... I sent SIG_HUP to postmaster, even restarted
postmaster.  The file /var/log/postgresql appears to be empty as well.

-Brice

"Brett W. McCoy" wrote:
>
> On Wed, 7 Feb 2001, Brice Ruth wrote:
>
> > Is there any way (besides ps) to view queries that are running on the
> > PostgreSQL server?  Something that actually output the query being run
> > would be great.
>
> You can set the logging option for query to 4, I believe, and it will log
> the full query by whatever logging facility you are using (syslog,
> redirected stdout or whatever).  Take a look in the admin docs for
> whatever version you are using.  There's a lot fo stuff you can log.
>
> If you are logging queries, you can open up the log file with tail -f and
> monitor the log as queries are being made.
>
> -- Brett
>                                      http://www.chapelperilous.net/~bmccoy/
> ---------------------------------------------------------------------------
> If you think the problem is bad now, just wait until we've solved it.
>                 -- Arthur Kasspe

--
Brice Ruth
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/

Re: monitoring running queries?

От
"Brett W. McCoy"
Дата:
On Thu, 8 Feb 2001, Brice Ruth wrote:

> Its not working ... I looked at the admin docs and edited the pg_options
> file appropriately ... the following is what appears in /var/log/messages:
>
> postgres[23686]: read_pg_options: verbose=2,query=4,syslog=2
>
> But no queries ... I sent SIG_HUP to postmaster, even restarted
> postmaster.  The file /var/log/postgresql appears to be empty as well.

I don't know how you are starting postgreSQL, but I just have it redirect
everything to a log file under the postgres super user's directory:

nohup postmaster [options] >>server.log 2>&1 &

Make sure you don't use the -S option -- it detaches from the tty and you
will get no output!

-- Brett
                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
Above all else -- sky.


Re: monitoring running queries?

От
Brice Ruth
Дата:
Cool, that worked.  Thank you.

-Brice

"Brett W. McCoy" wrote:
>
> On Thu, 8 Feb 2001, Brice Ruth wrote:
>
> > Its not working ... I looked at the admin docs and edited the pg_options
> > file appropriately ... the following is what appears in /var/log/messages:
> >
> > postgres[23686]: read_pg_options: verbose=2,query=4,syslog=2
> >
> > But no queries ... I sent SIG_HUP to postmaster, even restarted
> > postmaster.  The file /var/log/postgresql appears to be empty as well.
>
> I don't know how you are starting postgreSQL, but I just have it redirect
> everything to a log file under the postgres super user's directory:
>
> nohup postmaster [options] >>server.log 2>&1 &
>
> Make sure you don't use the -S option -- it detaches from the tty and you
> will get no output!
>
> -- Brett
>                                      http://www.chapelperilous.net/~bmccoy/
> ---------------------------------------------------------------------------
> Above all else -- sky.

--
Brice Ruth
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/