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
posta 3 anni fa247 visualizzazioni
1 Risposta
0
Risposta accettata

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;

con risposta 3 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande