relational database - PostgreSQL find locks including the table name -


i'm trying take @ locks happening on specific tables in postgresql database.

i see there's table called pg_locks

select * pg_locks; 

which seems give me bunch of columns possible find relation because see 1 of columns relation oid.

what table must link to relation name?

try :

select nspname,relname,l.* pg_locks l join pg_class c on   (relation=c.oid) join pg_namespace nsp on (c.relnamespace=nsp.oid)    pid in (select procpid pg_stat_activity    datname=current_database() , current_query!=current_query()) 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -