### Install pglockanalyze with cargo Source: https://github.com/agis/pglockanalyze/blob/main/README.md Install the pglockanalyze binary using cargo. No pre-built binaries are distributed yet. ```shell $ cargo install pglockanalyze ``` -------------------------------- ### Show pglockanalyze help Source: https://github.com/agis/pglockanalyze/blob/main/README.md Display the help text for pglockanalyze, listing all command-line options such as --db, --format, --distinct-transactions, and --commit. ```shell Usage: pglockanalyze [OPTIONS] --db [INPUT] Arguments: [INPUT] The DDL statements to analyze. If not provided or is -, read from standard input [default: -] Options: --db The database to connect to -f, --format The output format of the analysis [default: plain] [possible values: plain, json] --distinct-transactions Execute each statement in its own transaction. By default all statements are executed in a single transaction. Implies --commit --commit Commit the transactions. By default they are rolled back -h, --help Print help -V, --version Print version ``` -------------------------------- ### Analyze a DDL statement with pglockanalyze Source: https://github.com/agis/pglockanalyze/blob/main/README.md Pipe a DDL statement to pglockanalyze with a database connection string. The tool prints the statement and the locks acquired, e.g., an AccessExclusive lock on the users table. ```shell $ echo 'ALTER TABLE users ALTER COLUMN name SET NOT NULL' | pglockanalyze --db 'postgres://foo@bar' ALTER TABLE users ALTER COLUMN name SET NOT NULL acquired `AccessExclusive` lock on relation `users` (oid=16386) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.