pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to list what queries are running in postgres?
5+ messages / 4 participants
[nested] [flat]
* How to list what queries are running in postgres?
@ 2004-06-23 21:34 P.A.M. van Dam <pam@ramoth.xs4all.nl>
0 siblings, 1 reply; 5+ messages in thread
From: P.A.M. van Dam @ 2004-06-23 21:34 UTC (permalink / raw)
To: pgsql-admin
Hi!
I'm looking for a command or method to find out what queries are
currently being serviced by the database.
Once in a while a query goes berzerk and uses up all CPU. I'd like to
find out which query is the culprit and want to kill it off. In Sybase
you can get a list of running "processes" within the database and kill
the offending one. Is there an equivalent in postgres?
Right now we only have the method to shutdown the database en restart it
to get rid of the culprit.
Thanks in advance!
Best regards,
Pascal
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to list what queries are running in postgres?
@ 2004-06-29 21:19 Gaetano Mendola <mendola@bigfoot.com>
parent: P.A.M. van Dam <pam@ramoth.xs4all.nl>
0 siblings, 1 reply; 5+ messages in thread
From: Gaetano Mendola @ 2004-06-29 21:19 UTC (permalink / raw)
To: P.A.M. van Dam <pam@ramoth.xs4all.nl>
P.A.M. van Dam wrote:
> Hi!
>
> I'm looking for a command or method to find out what queries are
> currently being serviced by the database.
select * from pg_stat_activity;
Regards
Gaetano Mendola
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to list what queries are running in postgres?
@ 2004-06-30 03:37 Tom Lane <tgl@sss.pgh.pa.us>
parent: Gaetano Mendola <mendola@bigfoot.com>
0 siblings, 2 replies; 5+ messages in thread
From: Tom Lane @ 2004-06-30 03:37 UTC (permalink / raw)
To: Gaetano Mendola <mendola@bigfoot.com>; +Cc: P.A.M. van Dam <pam@ramoth.xs4all.nl>; pgsql-admin
Gaetano Mendola <mendola@bigfoot.com> writes:
> P.A.M. van Dam wrote:
>> I'm looking for a command or method to find out what queries are
>> currently being serviced by the database.
> select * from pg_stat_activity;
... having first remembered to turn on stats_command_string; and
thou shalt also be superuser.
[ anybody else remember Monty Python's scriptures concerning the
Holy Hand Grenade? ]
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to list what queries are running in postgres?
@ 2004-06-30 08:43 Gaetano Mendola <mendola@bigfoot.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 5+ messages in thread
From: Gaetano Mendola @ 2004-06-30 08:43 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>
Tom Lane wrote:
> Gaetano Mendola <mendola@bigfoot.com> writes:
>
>>P.A.M. van Dam wrote:
>>
>>>I'm looking for a command or method to find out what queries are
>>>currently being serviced by the database.
>
>
>>select * from pg_stat_activity;
>
>
> ... having first remembered to turn on stats_command_string; and
> thou shalt also be superuser.
>
> [ anybody else remember Monty Python's scriptures concerning the
> Holy Hand Grenade? ]
Do you mean this ?
Then did he raise on high the Holy Hand Grenade of Antioch, saying,
"Bless this, O Lord, that with it thou mayst blow thine enemies to
tiny bits, in thy mercy." And the people did rejoice and did feast
upon the lambs and toads and tree-sloths and fruit-bats and orangutans
and breakfast cereals ... Now did the Lord say, "First thou pullest
the Holy Pin. Then thou must count to three. Three shall be the number
of the counting and the number of the counting shall be three. Four
shalt thou not count, neither shalt thou count two, excepting that
thou then proceedeth to three. Five is right out. Once the number
three, being the number of the counting, be reached, then lobbest
thou the Holy Hand Grenade in the direction of thine foe, who, being
naughty in my sight, shall snuff it."
:-)
Regards
Gaetano Mendola
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to list what queries are running in postgres?
@ 2004-07-06 02:27 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 5+ messages in thread
From: Bruce Momjian @ 2004-07-06 02:27 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Gaetano Mendola <mendola@bigfoot.com>; P.A.M. van Dam <pam@ramoth.xs4all.nl>; pgsql-admin
Tom Lane wrote:
> Gaetano Mendola <mendola@bigfoot.com> writes:
> > P.A.M. van Dam wrote:
> >> I'm looking for a command or method to find out what queries are
> >> currently being serviced by the database.
>
> > select * from pg_stat_activity;
>
> ... having first remembered to turn on stats_command_string; and
> thou shalt also be superuser.
And 7.5 will print out a more helpful message if you forget to set
these:
test=> select * from pg_stat_activity;
datid | datname | procpid | usesysid | usename | current_query | query_start
-------+---------+---------+----------+----------+------------------------------+-------------
17227 | test | 15527 | 100 | guest | <command string not enabled> |
17227 | test | 15574 | 1 | postgres | <insufficient privilege> |
(2 rows)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2004-07-06 02:27 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-06-23 21:34 How to list what queries are running in postgres? P.A.M. van Dam <pam@ramoth.xs4all.nl>
2004-06-29 21:19 ` Gaetano Mendola <mendola@bigfoot.com>
2004-06-30 03:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-06-30 08:43 ` Gaetano Mendola <mendola@bigfoot.com>
2004-07-06 02:27 ` Bruce Momjian <pgman@candle.pha.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox