Truncate table hanging with no other running queries

0

Maybe once every other month I get a truncate table command that just hangs and dies. Never on the same table, and when I check for other running queries there are none except the truncate (select * from stv_recents where status<>'Done'). I need to reboot the server to get it to run. How can I identify what is actually locking the table?

bryanam
質問済み 3年前246ビュー
1回答
0
承認された回答

Here's a few stock queries I use to investigate

select t.relname,pid,mode,granted
from pg_locks l, pg_stat_all_tables t
where l.relation=t.relid order by relation asc;

select distinct(relation) table_id
,xid
,pid
,txn_start
,lock_mode
,trim(nspname) schema_name
,trim(relname) table_name
from svv_transactions
left join pg_class on pg_class.oid = svv_transactions.relation
join pg_namespace on pg_namespace.oid = relnamespace;

You can also use stv_locks;

回答済み 3年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ