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
preguntada hace 3 años246 visualizaciones
1 Respuesta
0
Respuesta aceptada

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;

respondido hace 3 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas