Class LockTable

java.lang.Object
org.apache.derby.vti.VTITemplate
org.apache.derby.diag.LockTable
All Implemented Interfaces:
AutoCloseable, ResultSet, Wrapper, AwareVTI, VTICosting

public class LockTable extends VTITemplate implements VTICosting
LockTable is a virtual table that shows all locks currently held in the database. This virtual table can be invoked by calling it directly
 select * from SYSCS_DIAG.LOCK_TABLE 

The LockTable virtual table takes a snap shot of the lock table while the system is in flux, so it is possible that some locks may be in transition state while the snap shot is taken. We choose to do this rather then impose extranous timing restrictions so that the use of this tool will not alter the normal timing and flow of execution in the application.

The LockTable virtual table has the following columns:

  • XID varchar(15) - not nullable. The transaction id, this can be joined with the TransactionTable virtual table's XID.
  • TYPE varchar(5) - nullable. The type of lock, ROW, TABLE, or LATCH
  • MODE varchar(4) - not nullable. The mode of the lock, "S", "U", "X", "IS", "IX".
    • S is shared lock (N/A to Latch)
    • U is update lock (N/A to Latch)
    • X is exclusive lock
    • IS is intent shared lock (N/A to Latch or Row lock)
    • IX is intent exclusive lock (N/A to Latch or Row lock)
  • TABLENAME varchar(128) - not nullable. The name of the base table the lock is for
  • LOCKNAME varchar(20) - not nullable. The name of the lock
  • STATE varchar(5) - nullable. GRANT or WAIT
  • TABLETYPE varchar(9) - not nullable. 'T' for user table, 'S' for system table
  • LOCKCOUNT varchar(5) - not nullable. Internal lock count.
  • INDEXNAME varchar(128) - normally null. If non-null, a lock is held on the index.