`heroku pg` =========== manage postgresql databases * [`heroku pg [DATABASE]`](#heroku-pg-database) * [`heroku pg:backups`](#heroku-pgbackups) * [`heroku pg:backups:cancel [BACKUP_ID]`](#heroku-pgbackupscancel-backup_id) * [`heroku pg:backups:capture [DATABASE]`](#heroku-pgbackupscapture-database) * [`heroku pg:backups:delete BACKUP_ID`](#heroku-pgbackupsdelete-backup_id) * [`heroku pg:backups:download [BACKUP_ID]`](#heroku-pgbackupsdownload-backup_id) * [`heroku pg:backups:info [BACKUP_ID]`](#heroku-pgbackupsinfo-backup_id) * [`heroku pg:backups:restore [BACKUP] [DATABASE]`](#heroku-pgbackupsrestore-backup-database) * [`heroku pg:backups:schedule [DATABASE]`](#heroku-pgbackupsschedule-database) * [`heroku pg:backups:schedules`](#heroku-pgbackupsschedules) * [`heroku pg:backups:unschedule [DATABASE]`](#heroku-pgbackupsunschedule-database) * [`heroku pg:backups:url [BACKUP_ID]`](#heroku-pgbackupsurl-backup_id) * [`heroku pg:bloat [DATABASE]`](#heroku-pgbloat-database) * [`heroku pg:blocking [DATABASE]`](#heroku-pgblocking-database) * [`heroku pg:cache-hit [DATABASE]`](#heroku-pgcache-hit-database) * [`heroku pg:calls [DATABASE]`](#heroku-pgcalls-database) * [`heroku pg:connection-pooling:attach [DATABASE]`](#heroku-pgconnection-poolingattach-database) * [`heroku pg:copy SOURCE TARGET`](#heroku-pgcopy-source-target) * [`heroku pg:credentials [DATABASE]`](#heroku-pgcredentials-database) * [`heroku pg:credentials:create [DATABASE]`](#heroku-pgcredentialscreate-database) * [`heroku pg:credentials:destroy [DATABASE]`](#heroku-pgcredentialsdestroy-database) * [`heroku pg:credentials:repair-default [DATABASE]`](#heroku-pgcredentialsrepair-default-database) * [`heroku pg:credentials:rotate [DATABASE]`](#heroku-pgcredentialsrotate-database) * [`heroku pg:credentials:url [DATABASE]`](#heroku-pgcredentialsurl-database) * [`heroku pg:diagnose [DATABASE|REPORT_ID]`](#heroku-pgdiagnose-databasereport_id) * [`heroku pg:extensions [DATABASE]`](#heroku-pgextensions-database) * [`heroku pg:fdwsql PREFIX [DATABASE]`](#heroku-pgfdwsql-prefix-database) * [`heroku pg:index-size [DATABASE]`](#heroku-pgindex-size-database) * [`heroku pg:index-usage [DATABASE]`](#heroku-pgindex-usage-database) * [`heroku pg:info [DATABASE]`](#heroku-pginfo-database) * [`heroku pg:kill PID [DATABASE]`](#heroku-pgkill-pid-database) * [`heroku pg:killall [DATABASE]`](#heroku-pgkillall-database) * [`heroku pg:links [DATABASE]`](#heroku-pglinks-database) * [`heroku pg:links:create REMOTE DATABASE`](#heroku-pglinkscreate-remote-database) * [`heroku pg:links:destroy DATABASE LINK`](#heroku-pglinksdestroy-database-link) * [`heroku pg:locks [DATABASE]`](#heroku-pglocks-database) * [`heroku pg:long-running-queries [DATABASE]`](#heroku-pglong-running-queries-database) * [`heroku pg:mandelbrot [DATABASE]`](#heroku-pgmandelbrot-database) * [`heroku pg:outliers [DATABASE]`](#heroku-pgoutliers-database) * [`heroku pg:promote DATABASE`](#heroku-pgpromote-database) * [`heroku pg:ps [DATABASE]`](#heroku-pgps-database) * [`heroku pg:psql [DATABASE]`](#heroku-pgpsql-database) * [`heroku pg:pull SOURCE TARGET`](#heroku-pgpull-source-target) * [`heroku pg:push SOURCE TARGET`](#heroku-pgpush-source-target) * [`heroku pg:records-rank [DATABASE]`](#heroku-pgrecords-rank-database) * [`heroku pg:reset [DATABASE]`](#heroku-pgreset-database) * [`heroku pg:seq-scans [DATABASE]`](#heroku-pgseq-scans-database) * [`heroku pg:settings [DATABASE]`](#heroku-pgsettings-database) * [`heroku pg:settings:auto-explain [DATABASE] [VALUE]`](#heroku-pgsettingsauto-explain-database-value) * [`heroku pg:settings:auto-explain:log-analyze [DATABASE] [VALUE]`](#heroku-pgsettingsauto-explainlog-analyze-database-value) * [`heroku pg:settings:auto-explain:log-buffers [DATABASE] [VALUE]`](#heroku-pgsettingsauto-explainlog-buffers-database-value) * [`heroku pg:settings:auto-explain:log-format [DATABASE] [VALUE]`](#heroku-pgsettingsauto-explainlog-format-database-value) * [`heroku pg:settings:auto-explain:log-min-duration [DATABASE] [VALUE]`](#heroku-pgsettingsauto-explainlog-min-duration-database-value) * [`heroku pg:settings:auto-explain:log-nested-statements [DATABASE] [VALUE]`](#heroku-pgsettingsauto-explainlog-nested-statements-database-value) * [`heroku pg:settings:auto-explain:log-triggers [DATABASE] [VALUE]`](#heroku-pgsettingsauto-explainlog-triggers-database-value) * [`heroku pg:settings:auto-explain:log-verbose [DATABASE] [VALUE]`](#heroku-pgsettingsauto-explainlog-verbose-database-value) * [`heroku pg:settings:data-connector-details-logs [DATABASE] [VALUE]`](#heroku-pgsettingsdata-connector-details-logs-database-value) * [`heroku pg:settings:explain-data-connector-details [DATABASE] [VALUE]`](#heroku-pgsettingsexplain-data-connector-details-database-value) * [`heroku pg:settings:log-connections [DATABASE] [VALUE]`](#heroku-pgsettingslog-connections-database-value) * [`heroku pg:settings:log-lock-waits [DATABASE] [VALUE]`](#heroku-pgsettingslog-lock-waits-database-value) * [`heroku pg:settings:log-min-duration-statement [DATABASE] [VALUE]`](#heroku-pgsettingslog-min-duration-statement-database-value) * [`heroku pg:settings:log-min-error-statement [DATABASE] [VALUE]`](#heroku-pgsettingslog-min-error-statement-database-value) * [`heroku pg:settings:log-statement [DATABASE] [VALUE]`](#heroku-pgsettingslog-statement-database-value) * [`heroku pg:settings:track-functions [DATABASE] [VALUE]`](#heroku-pgsettingstrack-functions-database-value) * [`heroku pg:stats-reset [DATABASE]`](#heroku-pgstats-reset-database) * [`heroku pg:table_size [DATABASE]`](#heroku-pgtable_size-database) * [`heroku pg:table-indexes-size [DATABASE]`](#heroku-pgtable-indexes-size-database) * [`heroku pg:table-size [DATABASE]`](#heroku-pgtable-size-database) * [`heroku pg:total_table_size [DATABASE]`](#heroku-pgtotal_table_size-database) * [`heroku pg:total-index-size [DATABASE]`](#heroku-pgtotal-index-size-database) * [`heroku pg:total-table-size [DATABASE]`](#heroku-pgtotal-table-size-database) * [`heroku pg:unfollow DATABASE`](#heroku-pgunfollow-database) * [`heroku pg:unused_indexes [DATABASE]`](#heroku-pgunused_indexes-database) * [`heroku pg:unused-indexes [DATABASE]`](#heroku-pgunused-indexes-database) * [`heroku pg:upgrade:cancel [DATABASE]`](#heroku-pgupgradecancel-database) * [`heroku pg:upgrade:dryrun [DATABASE]`](#heroku-pgupgradedryrun-database) * [`heroku pg:upgrade:prepare [DATABASE]`](#heroku-pgupgradeprepare-database) * [`heroku pg:upgrade:run [DATABASE]`](#heroku-pgupgraderun-database) * [`heroku pg:upgrade:wait [DATABASE]`](#heroku-pgupgradewait-database) * [`heroku pg:user-connections [DATABASE]`](#heroku-pguser-connections-database) * [`heroku pg:vacuum-stats [DATABASE]`](#heroku-pgvacuum-stats-database) * [`heroku pg:wait [DATABASE]`](#heroku-pgwait-database) ## `heroku pg [DATABASE]` show database information ``` USAGE $ heroku pg [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use all databases. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show database information ALIASES $ heroku pg ``` ## `heroku pg:backups` list database backups ``` USAGE $ heroku pg:backups -a [--prompt] [-r ] FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION list database backups ``` _See code: [src/commands/pg/backups/index.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/index.ts)_ ## `heroku pg:backups:cancel [BACKUP_ID]` cancel an in-progress backup or restore (default newest) ``` USAGE $ heroku pg:backups:cancel [BACKUP_ID] -a [--prompt] [-r ] ARGUMENTS [BACKUP_ID] ID of the backup. If omitted, we use the last unfinished backup ID. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION cancel an in-progress backup or restore (default newest) ``` _See code: [src/commands/pg/backups/cancel.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/cancel.ts)_ ## `heroku pg:backups:capture [DATABASE]` capture a new backup ``` USAGE $ heroku pg:backups:capture [DATABASE] -a [--prompt] [-r ] [-v] [--wait-interval ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use -v, --verbose --wait-interval= GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION capture a new backup ``` _See code: [src/commands/pg/backups/capture.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/capture.ts)_ ## `heroku pg:backups:delete BACKUP_ID` delete a backup ``` USAGE $ heroku pg:backups:delete BACKUP_ID -a [--prompt] [-r ] ARGUMENTS BACKUP_ID ID of the backup FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION delete a backup EXAMPLES $ heroku pg:backup:delete --app APP_ID BACKUP_ID ``` _See code: [src/commands/pg/backups/delete.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/delete.ts)_ ## `heroku pg:backups:download [BACKUP_ID]` downloads database backup ``` USAGE $ heroku pg:backups:download [BACKUP_ID] -a [--prompt] [-o ] [-r ] ARGUMENTS [BACKUP_ID] ID of the backup. If omitted, we use the last backup ID. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -o, --output= location to download to. Defaults to latest.dump -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION downloads database backup ``` _See code: [src/commands/pg/backups/download.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/download.ts)_ ## `heroku pg:backups:info [BACKUP_ID]` get information about a specific backup ``` USAGE $ heroku pg:backups:info [BACKUP_ID] -a [--prompt] [-r ] ARGUMENTS [BACKUP_ID] ID of the backup. If omitted, we use the last backup ID. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION get information about a specific backup ``` _See code: [src/commands/pg/backups/info.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/info.ts)_ ## `heroku pg:backups:restore [BACKUP] [DATABASE]` restore a backup (default latest) to a database ``` USAGE $ heroku pg:backups:restore [BACKUP] [DATABASE] -a [--prompt] [-c ] [-e ] [-r ] [-v] [--wait-interval ] ARGUMENTS [BACKUP] URL or backup ID from another app [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= -e, --extensions= comma-separated list of extensions to pre-install in the default public schema or an optional custom schema (for example: hstore or myschema.hstore) -r, --remote= git remote of app to use -v, --verbose --wait-interval= [default: 3] GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION restore a backup (default latest) to a database EXAMPLES # Basic Restore from Backup ID $ heroku pg:backups:restore b101 DATABASE_URL --app my-heroku-app # Restore from Another App $ heroku pg:backups:restore example-app::b101 DATABASE_URL --app my-heroku-app # Restore from a Public URL $ heroku pg:backups:restore "https://s3.amazonaws.com/my-bucket/mydb.dump" DATABASE_URL --app my-heroku-app # Verbose Output $ heroku pg:backups:restore b101 DATABASE_URL --app my-heroku-app --verbose # Restore with Confirmation Prompt $ heroku pg:backups:restore b101 DATABASE_URL --app my-heroku-app --confirm my-heroku-app # Restore with a Specific Database Name $ heroku pg:backups:restore b101 HEROKU_POSTGRESQL_PINK --app my-heroku-app ``` _See code: [src/commands/pg/backups/restore.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/restore.ts)_ ## `heroku pg:backups:schedule [DATABASE]` schedule daily backups for given database ``` USAGE $ heroku pg:backups:schedule [DATABASE] -a --at [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --at= (required) at a specific (24h) hour in the given timezone. Defaults to UTC. --at '[HOUR]:00 [TIMEZONE]' GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION schedule daily backups for given database ``` _See code: [src/commands/pg/backups/schedule.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/schedule.ts)_ ## `heroku pg:backups:schedules` list backup schedule ``` USAGE $ heroku pg:backups:schedules -a [--prompt] [-r ] FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION list backup schedule ``` _See code: [src/commands/pg/backups/schedules.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/schedules.ts)_ ## `heroku pg:backups:unschedule [DATABASE]` stop daily backups ``` USAGE $ heroku pg:backups:unschedule [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use a random database attached to the app. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION stop daily backups ``` _See code: [src/commands/pg/backups/unschedule.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/unschedule.ts)_ ## `heroku pg:backups:url [BACKUP_ID]` get secret but publicly accessible URL of a backup ``` USAGE $ heroku pg:backups:url [BACKUP_ID] -a [--prompt] [-r ] ARGUMENTS [BACKUP_ID] ID of the backup. If omitted, we use the last backup ID. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION get secret but publicly accessible URL of a backup ``` _See code: [src/commands/pg/backups/url.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/backups/url.ts)_ ## `heroku pg:bloat [DATABASE]` show table and index bloat in your database ordered by most wasteful ``` USAGE $ heroku pg:bloat [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show table and index bloat in your database ordered by most wasteful ``` _See code: [src/commands/pg/bloat.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/bloat.ts)_ ## `heroku pg:blocking [DATABASE]` display queries holding locks other queries are waiting to be released ``` USAGE $ heroku pg:blocking [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION display queries holding locks other queries are waiting to be released ``` _See code: [src/commands/pg/blocking.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/blocking.ts)_ ## `heroku pg:cache-hit [DATABASE]` show index and table hit rate ``` USAGE $ heroku pg:cache-hit [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show index and table hit rate EXAMPLES $ heroku pg:cache-hit --app example-app ``` _See code: [src/commands/pg/cache-hit.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/cache-hit.ts)_ ## `heroku pg:calls [DATABASE]` show 10 queries that have highest frequency of execution ``` USAGE $ heroku pg:calls [DATABASE] -a [--prompt] [-r ] [-t] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use -t, --truncate truncate queries to 40 characters GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show 10 queries that have highest frequency of execution EXAMPLES $ heroku pg:calls --app example-app # truncate queries to 40 characters $ heroku pg:calls --truncate --app example-app ``` _See code: [src/commands/pg/calls.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/calls.ts)_ ## `heroku pg:connection-pooling:attach [DATABASE]` add an attachment to a database using connection pooling ``` USAGE $ heroku pg:connection-pooling:attach [DATABASE] -a [--prompt] [--as ] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --as= name for add-on attachment GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION add an attachment to a database using connection pooling EXAMPLES $ heroku pg:connection-pooling:attach postgresql-something-12345 ``` _See code: [src/commands/pg/connection-pooling/attach.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/connection-pooling/attach.ts)_ ## `heroku pg:copy SOURCE TARGET` copy all data from source db to target ``` USAGE $ heroku pg:copy SOURCE TARGET -a [--prompt] [--confirm ] [-r ] [--verbose] [--wait-interval ] ARGUMENTS SOURCE config var exposed to the owning app containing the source database URL TARGET config var exposed to the owning app containing the target database URL FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --confirm= --verbose --wait-interval= GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION copy all data from source db to target ``` _See code: [src/commands/pg/copy.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/copy.ts)_ ## `heroku pg:credentials [DATABASE]` show information on credentials in the database ``` USAGE $ heroku pg:credentials [DATABASE] -a [--prompt] [--no-wrap] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --no-wrap disable wrapped table cells for easier copy/paste GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show information on credentials in the database ``` _See code: [src/commands/pg/credentials.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/credentials.ts)_ ## `heroku pg:credentials:create [DATABASE]` create credential within database ``` USAGE $ heroku pg:credentials:create [DATABASE] -a -n [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -n, --name= (required) name of the new credential within the database -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION create credential within database EXAMPLES $ heroku pg:credentials:create postgresql-something-12345 --name new-cred-name ``` _See code: [src/commands/pg/credentials/create.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/credentials/create.ts)_ ## `heroku pg:credentials:destroy [DATABASE]` destroy credential within database ``` USAGE $ heroku pg:credentials:destroy [DATABASE] -a -n [--prompt] [-c ] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= set to app name to bypass confirm prompt -n, --name= (required) unique identifier for the credential -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION destroy credential within database EXAMPLES $ heroku pg:credentials:destroy postgresql-transparent-56874 --name cred-name -a woodstock-production ``` _See code: [src/commands/pg/credentials/destroy.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/credentials/destroy.ts)_ ## `heroku pg:credentials:repair-default [DATABASE]` repair the permissions of the default credential within database ``` USAGE $ heroku pg:credentials:repair-default [DATABASE] -a [--prompt] [-c ] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= set to app name to bypass confirm prompt -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION repair the permissions of the default credential within database EXAMPLES $ heroku pg:credentials:repair-default postgresql-something-12345 ``` _See code: [src/commands/pg/credentials/repair-default.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/credentials/repair-default.ts)_ ## `heroku pg:credentials:rotate [DATABASE]` rotate the database credentials ``` USAGE $ heroku pg:credentials:rotate [DATABASE] -a [--prompt] [--all | -n ] [-c ] [--force] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= set to app name to bypass confirm prompt -n, --name= which credential to rotate (default credentials if not specified and --all is not used) -r, --remote= git remote of app to use --all rotate all credentials --force forces rotating the targeted credentials GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION rotate the database credentials ``` _See code: [src/commands/pg/credentials/rotate.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/credentials/rotate.ts)_ ## `heroku pg:credentials:url [DATABASE]` show information on a database credential ``` USAGE $ heroku pg:credentials:url [DATABASE] -a [--prompt] [-n ] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -n, --name= [default: default] which credential to show (default credentials if not specified) -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show information on a database credential ``` _See code: [src/commands/pg/credentials/url.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/credentials/url.ts)_ ## `heroku pg:diagnose [DATABASE|REPORT_ID]` run or view diagnostics report ``` USAGE $ heroku pg:diagnose [DATABASE|REPORT_ID] -a [--prompt] [--json] [-r ] ARGUMENTS [DATABASE|REPORT_ID] config var exposed to the owning app containing the database URL or the report ID FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --json format output as JSON GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION run or view diagnostics report defaults to DATABASE_URL database if no DATABASE is specified if REPORT_ID is specified instead, a previous report is displayed ``` _See code: [src/commands/pg/diagnose.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/diagnose.ts)_ ## `heroku pg:extensions [DATABASE]` list available and installed extensions ``` USAGE $ heroku pg:extensions [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION list available and installed extensions EXAMPLES $ heroku pg:extensions --app example-app ``` _See code: [src/commands/pg/extensions.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/extensions.ts)_ ## `heroku pg:fdwsql PREFIX [DATABASE]` generate fdw install sql for database ``` USAGE $ heroku pg:fdwsql PREFIX [DATABASE] -a [--prompt] [-r ] ARGUMENTS PREFIX prefix for foreign data wrapper [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION generate fdw install sql for database EXAMPLES $ heroku pg:fdwsql example_prefix --app example-app ``` _See code: [src/commands/pg/fdwsql.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/fdwsql.ts)_ ## `heroku pg:index-size [DATABASE]` show the size of indexes, descending by size ``` USAGE $ heroku pg:index-size [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show the size of indexes, descending by size EXAMPLES $ heroku pg:index-size --app example-app ``` _See code: [src/commands/pg/index-size.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/index-size.ts)_ ## `heroku pg:index-usage [DATABASE]` calculates your index hit rate (effective databases are at 99% and up) ``` USAGE $ heroku pg:index-usage [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION calculates your index hit rate (effective databases are at 99% and up) EXAMPLES $ heroku pg:index-usage --app example-app ``` _See code: [src/commands/pg/index-usage.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/index-usage.ts)_ ## `heroku pg:info [DATABASE]` show database information ``` USAGE $ heroku pg:info [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use all databases. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show database information ALIASES $ heroku pg ``` _See code: [src/commands/pg/info.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/info.ts)_ ## `heroku pg:kill PID [DATABASE]` kill a query ``` USAGE $ heroku pg:kill PID [DATABASE] -a [--prompt] [-f] [-r ] ARGUMENTS PID ID of the process [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -f, --force -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION kill a query ``` _See code: [src/commands/pg/kill.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/kill.ts)_ ## `heroku pg:killall [DATABASE]` terminates all connections for all credentials ``` USAGE $ heroku pg:killall [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION terminates all connections for all credentials ``` _See code: [src/commands/pg/killall.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/killall.ts)_ ## `heroku pg:links [DATABASE]` lists all databases and information on link ``` USAGE $ heroku pg:links [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION lists all databases and information on link ``` _See code: [src/commands/pg/links/index.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/links/index.ts)_ ## `heroku pg:links:create REMOTE DATABASE` create a link between data stores ``` USAGE $ heroku pg:links:create REMOTE DATABASE -a [--prompt] [--as ] [-r ] ARGUMENTS REMOTE config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` DATABASE config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --as= name of link to create GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION create a link between data stores EXAMPLES $ heroku pg:links:create HEROKU_REDIS_RED HEROKU_POSTGRESQL_CERULEAN ``` _See code: [src/commands/pg/links/create.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/links/create.ts)_ ## `heroku pg:links:destroy DATABASE LINK` destroys a link between data stores ``` USAGE $ heroku pg:links:destroy DATABASE LINK -a [--prompt] [-c ] [-r ] ARGUMENTS DATABASE config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` LINK name of the linked data store FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION destroys a link between data stores EXAMPLES $ heroku pg:links:destroy HEROKU_POSTGRESQL_CERULEAN redis-symmetrical-100 ``` _See code: [src/commands/pg/links/destroy.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/links/destroy.ts)_ ## `heroku pg:locks [DATABASE]` display queries with active locks ``` USAGE $ heroku pg:locks [DATABASE] -a [--prompt] [-r ] [-t] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use -t, --truncate truncates queries to 40 characters GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION display queries with active locks ``` _See code: [src/commands/pg/locks.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/locks.ts)_ ## `heroku pg:long-running-queries [DATABASE]` show all queries longer than five minutes by descending duration ``` USAGE $ heroku pg:long-running-queries [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show all queries longer than five minutes by descending duration EXAMPLES $ heroku pg:long-running-queries --app example-app ``` _See code: [src/commands/pg/long-running-queries.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/long-running-queries.ts)_ ## `heroku pg:mandelbrot [DATABASE]` show the mandelbrot set ``` USAGE $ heroku pg:mandelbrot [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show the mandelbrot set EXAMPLES $ heroku pg:mandelbrot --app example-app ``` _See code: [src/commands/pg/mandelbrot.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/mandelbrot.ts)_ ## `heroku pg:outliers [DATABASE]` show 10 queries that have longest execution time in aggregate ``` USAGE $ heroku pg:outliers [DATABASE] -a [--prompt] [-n ] [-r ] [--reset] [-t] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -n, --num= the number of queries to display (default: 10) -r, --remote= git remote of app to use -t, --truncate truncate queries to 40 characters --reset resets statistics gathered by pg_stat_statements GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show 10 queries that have longest execution time in aggregate ``` _See code: [src/commands/pg/outliers.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/outliers.ts)_ ## `heroku pg:promote DATABASE` sets DATABASE as your DATABASE_URL ``` USAGE $ heroku pg:promote DATABASE -a [--prompt] [--as ] [-f] [-r ] ARGUMENTS DATABASE config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -f, --force -r, --remote= git remote of app to use --as= name for the database attachment GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION sets DATABASE as your DATABASE_URL ``` _See code: [src/commands/pg/promote.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/promote.ts)_ ## `heroku pg:ps [DATABASE]` view active queries with execution time ``` USAGE $ heroku pg:ps [DATABASE] -a [--prompt] [-r ] [-v] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use -v, --verbose GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION view active queries with execution time ``` _See code: [src/commands/pg/ps.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/ps.ts)_ ## `heroku pg:psql [DATABASE]` open a psql shell to the database ``` USAGE $ heroku pg:psql [DATABASE] -a [--prompt] [-c ] [--credential ] [-f ] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --command= SQL command to run -f, --file= SQL file to run -r, --remote= git remote of app to use --credential= credential to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION open a psql shell to the database ALIASES $ heroku psql ``` _See code: [src/commands/pg/psql.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/psql.ts)_ ## `heroku pg:pull SOURCE TARGET` pull Heroku database into local or remote database ``` USAGE $ heroku pg:pull SOURCE TARGET -a [--prompt] [--exclude-table-data ] [-r ] ARGUMENTS SOURCE config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. TARGET PostgreSQL connection string for the target database FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --exclude-table-data= tables for which data should be excluded (use ';' to split multiple names) GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION pull Heroku database into local or remote database Pull from SOURCE into TARGET. TARGET must be one of: * a database name (i.e. on a local PostgreSQL server) => TARGET must not exist and will be created * a fully qualified URL to a local PostgreSQL server => TARGET must not exist and will be created * a fully qualified URL to a remote PostgreSQL server => TARGET must exist and be empty To delete a local database run dropdb TARGET. To create an empty remote database, run createdb with connection command-line options (run createdb --help for details). EXAMPLES # pull Heroku DB named postgresql-swimmingly-100 into local DB mylocaldb that must not exist $ heroku pg:pull postgresql-swimmingly-100 mylocaldb --app sushi # pull Heroku DB named postgresql-swimmingly-100 into empty remote DB at postgres://myhost/mydb $ heroku pg:pull postgresql-swimmingly-100 postgres://myhost/mydb --app sushi ``` _See code: [src/commands/pg/pull.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/pull.ts)_ ## `heroku pg:push SOURCE TARGET` push local or remote into Heroku database ``` USAGE $ heroku pg:push SOURCE TARGET -a [--prompt] [--exclude-table-data ] [-r ] ARGUMENTS SOURCE PostgreSQL connection string for the source database TARGET config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --exclude-table-data= tables for which data should be excluded (use ';' to split multiple names) GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION push local or remote into Heroku database Push from SOURCE into TARGET. TARGET must be empty. To empty a Heroku database for push run heroku pg:reset SOURCE must be either the name of a database existing on your localhost or the fully qualified URL of a remote database. EXAMPLES # push mylocaldb into a Heroku DB named postgresql-swimmingly-100 $ heroku pg:push mylocaldb postgresql-swimmingly-100 --app sushi # push remote DB at postgres://myhost/mydb into a Heroku DB named postgresql-swimmingly-100 $ heroku pg:push postgres://myhost/mydb postgresql-swimmingly-100 --app sushi ``` _See code: [src/commands/pg/push.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/push.ts)_ ## `heroku pg:records-rank [DATABASE]` show all tables and the number of rows in each ordered by number of rows descending ``` USAGE $ heroku pg:records-rank [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show all tables and the number of rows in each ordered by number of rows descending EXAMPLES $ heroku pg:records-rank --app example-app ``` _See code: [src/commands/pg/records-rank.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/records-rank.ts)_ ## `heroku pg:reset [DATABASE]` delete all data in DATABASE ``` USAGE $ heroku pg:reset [DATABASE] -a [--prompt] [-c ] [-e ] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= -e, --extensions= comma-separated list of extensions to pre-install in the public schema -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION delete all data in DATABASE ``` _See code: [src/commands/pg/reset.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/reset.ts)_ ## `heroku pg:seq-scans [DATABASE]` show the count of sequential scans by table descending by order ``` USAGE $ heroku pg:seq-scans [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show the count of sequential scans by table descending by order EXAMPLES $ heroku pg:seq-scans --app example-app ``` _See code: [src/commands/pg/seq-scans.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/seq-scans.ts)_ ## `heroku pg:settings [DATABASE]` show your current database settings ``` USAGE $ heroku pg:settings [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show your current database settings ``` _See code: [src/commands/pg/settings/index.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/index.ts)_ ## `heroku pg:settings:auto-explain [DATABASE] [VALUE]` Automatically log execution plans of queries without running EXPLAIN by hand. ``` USAGE $ heroku pg:settings:auto-explain [DATABASE...] [VALUE...] -a [--prompt] [-r ] ARGUMENTS [DATABASE...] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE...] boolean indicating if execution plans of queries will be logged for future connections FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION Automatically log execution plans of queries without running EXPLAIN by hand. The auto_explain module is loaded at session-time so existing connections will not be logged. Restart your Heroku app and/or restart existing connections for logging to start taking place. ``` _See code: [src/commands/pg/settings/auto-explain.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/auto-explain.ts)_ ## `heroku pg:settings:auto-explain:log-analyze [DATABASE] [VALUE]` Shows actual run times on the execution plan. ``` USAGE $ heroku pg:settings:auto-explain:log-analyze [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] boolean indicating if execution plans get logged FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION Shows actual run times on the execution plan. This is equivalent to calling EXPLAIN ANALYZE. WARNING: EXPLAIN ANALYZE will be run on ALL queries, not just logged queries. This can cause significant performance impacts to your database and should be used with caution. ``` _See code: [src/commands/pg/settings/auto-explain/log-analyze.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/auto-explain/log-analyze.ts)_ ## `heroku pg:settings:auto-explain:log-buffers [DATABASE] [VALUE]` Includes buffer usage statistics when execution plans are logged. ``` USAGE $ heroku pg:settings:auto-explain:log-buffers [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] boolean indicating if the database has buffer statistics enabled FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION Includes buffer usage statistics when execution plans are logged. This is equivalent to calling EXPLAIN BUFFERS and can only be used in conjunction with pg:settings:auto-explain:log-analyze turned on. ``` _See code: [src/commands/pg/settings/auto-explain/log-buffers.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/auto-explain/log-buffers.ts)_ ## `heroku pg:settings:auto-explain:log-format [DATABASE] [VALUE]` selects the EXPLAIN output format to be used ``` USAGE $ heroku pg:settings:auto-explain:log-format [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] (text|json|yaml|xml) format of the log output FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION selects the EXPLAIN output format to be used The allowed values are text, xml, json, and yaml. The default is text. ``` _See code: [src/commands/pg/settings/auto-explain/log-format.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/auto-explain/log-format.ts)_ ## `heroku pg:settings:auto-explain:log-min-duration [DATABASE] [VALUE]` Sets the minimum execution time in milliseconds for a statement's plan to be logged. ``` USAGE $ heroku pg:settings:auto-explain:log-min-duration [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] minimum duration in milliseconds for queries before logging execution plans. A value of -1 disables it. A value of 0 logs all query execution plans. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION Sets the minimum execution time in milliseconds for a statement's plan to be logged. Setting this value to 0 will log all queries. Setting this value to -1 will disable logging entirely. ``` _See code: [src/commands/pg/settings/auto-explain/log-min-duration.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/auto-explain/log-min-duration.ts)_ ## `heroku pg:settings:auto-explain:log-nested-statements [DATABASE] [VALUE]` Nested statements are included in the execution plan's log. ``` USAGE $ heroku pg:settings:auto-explain:log-nested-statements [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] boolean indicating if execution plan logs include nested statements FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION Nested statements are included in the execution plan's log. ``` _See code: [src/commands/pg/settings/auto-explain/log-nested-statements.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/auto-explain/log-nested-statements.ts)_ ## `heroku pg:settings:auto-explain:log-triggers [DATABASE] [VALUE]` Includes trigger execution statistics in execution plan logs. ``` USAGE $ heroku pg:settings:auto-explain:log-triggers [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] boolean indicating if the database has trigger execution statistics enabled FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION Includes trigger execution statistics in execution plan logs. This parameter can only be used in conjunction with pg:settings:auto-explain:log-analyze turned on. ``` _See code: [src/commands/pg/settings/auto-explain/log-triggers.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/auto-explain/log-triggers.ts)_ ## `heroku pg:settings:auto-explain:log-verbose [DATABASE] [VALUE]` Include verbose details in execution plans. ``` USAGE $ heroku pg:settings:auto-explain:log-verbose [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] boolean indicating if the database has verbose execution plan logging enabled FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION Include verbose details in execution plans. This is equivalent to calling EXPLAIN VERBOSE. ``` _See code: [src/commands/pg/settings/auto-explain/log-verbose.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/auto-explain/log-verbose.ts)_ ## `heroku pg:settings:data-connector-details-logs [DATABASE] [VALUE]` displays stats on replication slots on your database, the default value is "off" ``` USAGE $ heroku pg:settings:data-connector-details-logs [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] boolean indicating if data replication slot details get logged FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION displays stats on replication slots on your database, the default value is "off" ALIASES $ heroku pg:settings:explain-data-connector-details ``` _See code: [src/commands/pg/settings/data-connector-details-logs.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/data-connector-details-logs.ts)_ ## `heroku pg:settings:explain-data-connector-details [DATABASE] [VALUE]` displays stats on replication slots on your database, the default value is "off" ``` USAGE $ heroku pg:settings:explain-data-connector-details [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] boolean indicating if data replication slot details get logged FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION displays stats on replication slots on your database, the default value is "off" ALIASES $ heroku pg:settings:explain-data-connector-details ``` ## `heroku pg:settings:log-connections [DATABASE] [VALUE]` Controls whether a log message is produced when a login attempt is made. Default is true. ``` USAGE $ heroku pg:settings:log-connections [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] boolean indicating if database login attempts get logged FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION Controls whether a log message is produced when a login attempt is made. Default is true. Setting log_connections to false stops emitting log messages for all attempts to login to the database. ``` _See code: [src/commands/pg/settings/log-connections.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/log-connections.ts)_ ## `heroku pg:settings:log-lock-waits [DATABASE] [VALUE]` Controls whether a log message is produced when a session waits longer than the deadlock_timeout to acquire a lock. deadlock_timeout is set to 1 second ``` USAGE $ heroku pg:settings:log-lock-waits [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] boolean indicating if a message gets logged when a session waits longer than the deadlock_timeout to acquire a lock FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION Controls whether a log message is produced when a session waits longer than the deadlock_timeout to acquire a lock. deadlock_timeout is set to 1 second Delays due to lock contention occur when multiple transactions are trying to access the same resource at the same time. Applications and their query patterns should try to avoid changes to many different tables within the same transaction. ``` _See code: [src/commands/pg/settings/log-lock-waits.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/log-lock-waits.ts)_ ## `heroku pg:settings:log-min-duration-statement [DATABASE] [VALUE]` The duration of each completed statement will be logged if the statement completes after the time specified by VALUE. ``` USAGE $ heroku pg:settings:log-min-duration-statement [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] milliseconds to wait for a statement to complete before logging it FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION The duration of each completed statement will be logged if the statement completes after the time specified by VALUE. VALUE needs to specified as a whole number, in milliseconds. Setting log_min_duration_statement to zero prints all statement durations and -1 will disable logging statement durations. ``` _See code: [src/commands/pg/settings/log-min-duration-statement.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/log-min-duration-statement.ts)_ ## `heroku pg:settings:log-min-error-statement [DATABASE] [VALUE]` log-min-error-statement controls the logging of SQL statements that cause an error at a specified severity level. ``` USAGE $ heroku pg:settings:log-min-error-statement [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] (error|log|fatal|panic) FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION log-min-error-statement controls the logging of SQL statements that cause an error at a specified severity level. This setting is useful to prevent logging SQL statements that might contain sensitive information. Use this setting to prevent logging SQL queries that contain sensitive information. Default is "error". ``` _See code: [src/commands/pg/settings/log-min-error-statement.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/log-min-error-statement.ts)_ ## `heroku pg:settings:log-statement [DATABASE] [VALUE]` log_statement controls which SQL statements are logged. ``` USAGE $ heroku pg:settings:log-statement [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] (none|ddl|mod|all) type of SQL statements to log FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION log_statement controls which SQL statements are logged. Valid values for VALUE: none - No statements are logged ddl - All data definition statements, such as CREATE, ALTER and DROP will be logged mod - Includes all statements from ddl as well as data-modifying statements such as INSERT, UPDATE, DELETE, TRUNCATE, COPY all - All statements are logged ``` _See code: [src/commands/pg/settings/log-statement.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/log-statement.ts)_ ## `heroku pg:settings:track-functions [DATABASE] [VALUE]` track_functions controls tracking of function call counts and time used. Default is none. ``` USAGE $ heroku pg:settings:track-functions [DATABASE] [VALUE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. [VALUE] (none|pl|all) function type to track FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION track_functions controls tracking of function call counts and time used. Default is none. Valid values for VALUE: none - No functions are tracked (default) pl - Only procedural language functions are tracked all - All functions, including SQL and C language functions, are tracked. Simple SQL-language that are inlined are not tracked ``` _See code: [src/commands/pg/settings/track-functions.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/settings/track-functions.ts)_ ## `heroku pg:stats-reset [DATABASE]` calls the Postgres functions pg_stat_reset() ``` USAGE $ heroku pg:stats-reset [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION calls the Postgres functions pg_stat_reset() EXAMPLES $ heroku pg:stats-reset --app example-app ``` _See code: [src/commands/pg/stats-reset.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/stats-reset.ts)_ ## `heroku pg:table_size [DATABASE]` show the size of the tables (excluding indexes), descending by size ``` USAGE $ heroku pg:table_size [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show the size of the tables (excluding indexes), descending by size ALIASES $ heroku pg:table_size EXAMPLES $ heroku pg:table-size --app example-app ``` ## `heroku pg:table-indexes-size [DATABASE]` show the total size of all the indexes on each table, descending by size ``` USAGE $ heroku pg:table-indexes-size [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show the total size of all the indexes on each table, descending by size EXAMPLES $ heroku pg:table-indexes-size --app example-app ``` _See code: [src/commands/pg/table-indexes-size.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/table-indexes-size.ts)_ ## `heroku pg:table-size [DATABASE]` show the size of the tables (excluding indexes), descending by size ``` USAGE $ heroku pg:table-size [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show the size of the tables (excluding indexes), descending by size ALIASES $ heroku pg:table_size EXAMPLES $ heroku pg:table-size --app example-app ``` _See code: [src/commands/pg/table-size.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/table-size.ts)_ ## `heroku pg:total_table_size [DATABASE]` show the size of the tables (including indexes), descending by size ``` USAGE $ heroku pg:total_table_size [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show the size of the tables (including indexes), descending by size ALIASES $ heroku pg:total_table_size EXAMPLES $ heroku pg:total-table-size --app example-app ``` ## `heroku pg:total-index-size [DATABASE]` show the total size of all indexes in MB ``` USAGE $ heroku pg:total-index-size [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show the total size of all indexes in MB EXAMPLES $ heroku pg:total-index-size --app example-app ``` _See code: [src/commands/pg/total-index-size.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/total-index-size.ts)_ ## `heroku pg:total-table-size [DATABASE]` show the size of the tables (including indexes), descending by size ``` USAGE $ heroku pg:total-table-size [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show the size of the tables (including indexes), descending by size ALIASES $ heroku pg:total_table_size EXAMPLES $ heroku pg:total-table-size --app example-app ``` _See code: [src/commands/pg/total-table-size.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/total-table-size.ts)_ ## `heroku pg:unfollow DATABASE` stop a replica from following and make it a writeable database ``` USAGE $ heroku pg:unfollow DATABASE -a [--prompt] [-c ] [-r ] ARGUMENTS DATABASE config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION stop a replica from following and make it a writeable database ``` _See code: [src/commands/pg/unfollow.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/unfollow.ts)_ ## `heroku pg:unused_indexes [DATABASE]` show unused and almost unused indexes ``` USAGE $ heroku pg:unused_indexes [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show unused and almost unused indexes ALIASES $ heroku pg:unused_indexes EXAMPLES $ heroku pg:unused-indexes --app example-app ``` ## `heroku pg:unused-indexes [DATABASE]` show unused and almost unused indexes ``` USAGE $ heroku pg:unused-indexes [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show unused and almost unused indexes ALIASES $ heroku pg:unused_indexes EXAMPLES $ heroku pg:unused-indexes --app example-app ``` _See code: [src/commands/pg/unused-indexes.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/unused-indexes.ts)_ ## `heroku pg:upgrade:cancel [DATABASE]` cancels a scheduled upgrade. You can't cancel a version upgrade that's in progress. ``` USAGE $ heroku pg:upgrade:cancel [DATABASE] -a [--prompt] [-c ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION cancels a scheduled upgrade. You can't cancel a version upgrade that's in progress. ``` _See code: [src/commands/pg/upgrade/cancel.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/upgrade/cancel.ts)_ ## `heroku pg:upgrade:dryrun [DATABASE]` simulates a Postgres version upgrade on a Standard-tier and higher leader database by creating and upgrading a follower database. Heroku sends the results of the test upgrade via email. ``` USAGE $ heroku pg:upgrade:dryrun [DATABASE] -a [--prompt] [-c ] [-v ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= -v, --version= Postgres version to upgrade to GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION simulates a Postgres version upgrade on a Standard-tier and higher leader database by creating and upgrading a follower database. Heroku sends the results of the test upgrade via email. ``` _See code: [src/commands/pg/upgrade/dryrun.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/upgrade/dryrun.ts)_ ## `heroku pg:upgrade:prepare [DATABASE]` prepares the upgrade for Standard-tier and higher leader databases and schedules it for the next available maintenance window. To start a version upgrade on Essential-tier and follower databases, use heroku pg:upgrade:run instead. ``` USAGE $ heroku pg:upgrade:prepare [DATABASE] -a [--prompt] [-c ] [-v ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= -v, --version= Postgres version to upgrade to GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION prepares the upgrade for Standard-tier and higher leader databases and schedules it for the next available maintenance window. To start a version upgrade on Essential-tier and follower databases, use heroku pg:upgrade:run instead. ``` _See code: [src/commands/pg/upgrade/prepare.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/upgrade/prepare.ts)_ ## `heroku pg:upgrade:run [DATABASE]` starts a Postgres version upgrade ``` USAGE $ heroku pg:upgrade:run [DATABASE] -a [--prompt] [-c ] [-r ] [-v ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -c, --confirm= -r, --remote= git remote of app to use -v, --version= Postgres version to upgrade to GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION starts a Postgres version upgrade On Essential-tier databases, this command upgrades the database's Postgres version. On Standard-tier and higher leader databases, this command runs a previously scheduled Postgres version upgrade. You must run pg:upgrade:prepare before this command to schedule a version upgrade. On follower databases, this command unfollows the leader database before upgrading the follower's Postgres version. EXAMPLES # Upgrade an Essential-tier database to a specific version $ heroku pg:upgrade:run postgresql-curved-12345 --version 14 --app myapp # Upgrade a Standard-tier follower database to the latest supported version $ heroku pg:upgrade:run HEROKU_POSTGRESQL_BLUE_URL --app myapp # Run a previously scheduled upgrade on a Standard-tier leader database $ heroku pg:upgrade:run DATABASE_URL --app myapp ``` _See code: [src/commands/pg/upgrade/run.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/upgrade/run.ts)_ ## `heroku pg:upgrade:wait [DATABASE]` provides the status of an upgrade and blocks it until the operation is complete ``` USAGE $ heroku pg:upgrade:wait [DATABASE] -a [--prompt] [--no-notify] [-r ] [--wait-interval ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --no-notify do not show OS notification --wait-interval= how frequently to poll in seconds (to avoid rate limiting) GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION provides the status of an upgrade and blocks it until the operation is complete EXAMPLES # Wait for upgrade to complete with default settings $ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp # Wait with custom polling interval $ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp --wait-interval 10 # Wait without showing OS notifications $ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp --no-notify ``` _See code: [src/commands/pg/upgrade/wait.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/upgrade/wait.ts)_ ## `heroku pg:user-connections [DATABASE]` returns the number of connections per credential ``` USAGE $ heroku pg:user-connections [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION returns the number of connections per credential EXAMPLES $ heroku pg:user-connections --app example-app ``` _See code: [src/commands/pg/user-connections.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/user-connections.ts)_ ## `heroku pg:vacuum-stats [DATABASE]` show dead rows and whether an automatic vacuum is expected to be triggered ``` USAGE $ heroku pg:vacuum-stats [DATABASE] -a [--prompt] [-r ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use DATABASE_URL. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION show dead rows and whether an automatic vacuum is expected to be triggered ``` _See code: [src/commands/pg/vacuum-stats.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/vacuum-stats.ts)_ ## `heroku pg:wait [DATABASE]` blocks until database is available ``` USAGE $ heroku pg:wait [DATABASE] -a [--prompt] [--no-notify] [-r ] [--wait-interval ] ARGUMENTS [DATABASE] config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use all databases. FLAGS -a, --app= (required) [env: HEROKU_APP] app to run command against -r, --remote= git remote of app to use --no-notify do not show OS notification --wait-interval= how frequently to poll in seconds (to avoid rate limiting) GLOBAL FLAGS --prompt interactively prompt for command arguments and flags DESCRIPTION blocks until database is available ``` _See code: [src/commands/pg/wait.ts](https://github.com/heroku/cli/blob/v11.10.0/src/commands/pg/wait.ts)_