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
Post a Comment