The first set of steps is not strictly necessary if we have access to a particularly busy database. The lock tables are generally very active, and output in such a scenario is usually rather copious. Barring this, we need a way to purposefully demonstrate just how powerful the PostgreSQL lock debugging tools are.
Of the two queries that actually display PostgreSQL activity blocks, the first relies entirely upon the pg_locks view. After executing it, we should see this on an otherwise empty database:
pid | locktype | mode | granted | locked_object ------+----------+------------------+---------+--------------- 3147 | relation | AccessShareLock | t | pg_locks 3128 | relation | ExclusiveLock | t | lock_test 3137 | relation | ...