pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedkilling a query safely
2+ messages / 2 participants
[nested] [flat]
* killing a query safely
@ 2006-01-18 06:42 Rajesh Kumar Mallah <mallah@tradeindia.com>
0 siblings, 1 reply; 2+ messages in thread
From: Rajesh Kumar Mallah @ 2006-01-18 06:42 UTC (permalink / raw)
To: pgsql-admin
Hi,
many a times the backend are stubborn. A backend is currently
executing a Query , the query usually finishes quickly < 5 secs.
But this query is on for past many minutes. I want to debug why
it is hung if it is hung.
I have also tried to kill this query using following methods:
SQL> SELECT pg_cancel_backend(27649); # does not kill
# kill 27649 # does not kill
# kill -TERM 27649 # does not kill
# ps auxwww| grep 27649
postgres 27649 0.0 1.9 421060 81576 ? *S* 10:41 0:00
postgres: tradein tradein_clients 216.247.238.131(59261) SELECT
this query does not block any other
tradein_clients=# SELECT * from blockers;
+---------+---------+
| blocker | blockee |
+---------+---------+
+---------+---------+
(0 rows)
\d blockers
View "public.blockers"
+---------+---------+-----------+
| Column | Type | Modifiers |
+---------+---------+-----------+
| blocker | integer | |
| blockee | integer | |
+---------+---------+-----------+
View definition:*(Courtesy: Tom Lane)*
SELECT h.pid AS blocker, w.pid AS blockee
FROM ONLY pg_locks h, ONLY pg_locks w
WHERE h."granted" AND NOT w."granted" AND (h.relation = w.relation AND
h."database" = w."database" OR h."transaction" = w."transaction");
Can anyone please guide what should be done in such situations.
Regds
mallah.
--
Best Regards,
regds
Mallah.
Rajesh Kumar Mallah
+---------------------------------------------------+
| Tradeindia.com (3,97,300) Registered Users |
| Indias' Leading B2B eMarketPlace |
| http://www.tradeindia.com/ |
+---------------------------------------------------+
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: killing a query safely
@ 2006-01-19 20:42 Tom Lane <tgl@sss.pgh.pa.us>
parent: Rajesh Kumar Mallah <mallah@tradeindia.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2006-01-19 20:42 UTC (permalink / raw)
To: Rajesh Kumar Mallah <mallah@tradeindia.com>; +Cc: pgsql-admin
Rajesh Kumar Mallah <mallah@tradeindia.com> writes:
> many a times the backend are stubborn. A backend is currently
> executing a Query , the query usually finishes quickly < 5 secs.
> But this query is on for past many minutes. I want to debug why
> it is hung if it is hung.
Attach to the backend process with gdb and get a stack trace ---
that would at least give us some information to work with.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-01-19 20:42 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-18 06:42 killing a query safely Rajesh Kumar Mallah <mallah@tradeindia.com>
2006-01-19 20:42 ` Tom Lane <tgl@sss.pgh.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