Sunday, June 15, 2014

Show locks in a Netezza Database

This SQL statement when run in Aginity or nzsql will show you all sessions that cause locks in a database.
select sessionid, 
       clientip,
       username, 
       relname as table_name, 
       requesttime as lock_request_time,
       granttime as lock_acquired_time, 
       command as sql, 
       lockstate  
from _t_pg_locks 
where relid in ( select relid from _t_pg_locks where lockstate='WAIT') 
order by requesttime, granttime
To kill a session / transaction you can simply right click it under current sessions in Netezza Administrator.

No comments:

Post a Comment

Web Analytics