The pg_locks view provides access to information about the locks held by open transactions within Greenplum Database.

    pg_locks contains one row per active lockable object, requested lock mode, and relevant transaction. Thus, the same lockable object may appear many times if multiple transactions are holding or waiting for locks on it. An object with no current locks on it will not appear in the view at all.

    There are several distinct types of lockable objects: whole relations (such as tables), individual pages of relations, individual tuples of relations, transaction IDs (both virtual and permanent IDs), and general database objects. Also, the right to extend a relation is represented as a separate lockable object.

    columntypereferencesdescription
    locktypetext Type of the lockable object: relation, extend, page, tuple, transactionid, object, userlock, resource queue, or advisory
    databaseoidpg_database.oidOID of the database in which the object exists, zero if the object is a shared object, or NULL if the object is a transaction ID
    relationoidpg_class.oidOID of the relation, or NULL if the object is not a relation or part of a relation
    pageinteger Page number within the relation, or NULL if the object is not a tuple or relation page
    tuplesmallint Tuple number within the page, or NULL if the object is not a tuple
    virtualxidtext Virtual ID of a transaction, or NULL if the object is not a virtual transaction ID
    transactionidxid ID of a transaction, or NULL if the object is not a transaction ID
    classidoidpg_class.oidOID of the system catalog containing the object, or NULL if the object is not a general database object
    objidoidany OID columnOID of the object within its system catalog, or NULL if the object is not a general database object
    objsubidsmallint For a table column, this is the column number (the classid and objid refer to the table itself). For all other object types, this column is zero. NULL if the object is not a general database object
    virtualtransactiontext Virtual ID of the transaction that is holding or awaiting this lock
    pidinteger Process ID of the server process holding or awaiting this lock. NULL if the lock is held by a prepared transaction
    modetext Name of the lock mode held or desired by this process
    grantedboolean True if lock is held, false if lock is awaited.
    fastpathboolean True if lock was taken via fastpath, false if lock is taken via main lock table.
    mppsessionidinteger The id of the client session associated with this lock.
    mppiswriterboolean Specifies whether the lock is held by a writer process.
    gp_segment_idinteger The Greenplum segment id (dbid) where the lock is held.

    Parent topic: System Catalogs Definitions