pg-checkup
Workspace
HomeReports
GitHub
Run on GitHub
Learn
OverviewQuickstartChecks referenceTables that only growConnectingRun it on your machineMigration checksTools that helpSecurity & privacyUse with AI agentsMCP serverFAQ
Help
File a ticketRequest a featurePricing
PrivacyTerms
Docs/Run it on your machine
Sign inNew checkupC

Run it on your machine

The checkup runs on your computer. The connection string stays there. Nothing is uploaded unless you run upload.

npx pg-checkup@latest postgres://[email protected]/app

To install instead: npm install -g pg-checkup. Needs Node 18+.

Connect

It connects like psql:

  • a URL
  • -h HOST -p PORT -U USER -d DBNAME
  • --service NAME
  • PGHOST, PGUSER, PGDATABASE, PGSERVICE
  • DATABASE_URL in ./.env.local or ./.env

The password comes from the URL, PGPASSWORD, the service file, ~/.pgpass, or a prompt.

The login

Any login works. A login with only pg_monitor is safer. A login that can read tables gets a warning. --require-reader-role stops instead (exit 3).

Output

Findings in three groups: fix now, fix next, watch. A cause comes before what it causes: an idle transaction comes before the dead rows it keeps. -v lists every check.

The result is saved as JSON in ~/Downloads/checkup, or -o FILE. It holds statistics, settings, and table and role names. It never holds table rows or the connection string. Query text is kept with values replaced by ?. --omit-query-text leaves it out.

npx pg-checkup doctor             # test the connection and the login's access
npx pg-checkup show FILE          # print a saved checkup
npx pg-checkup show FILE --all    # every collected row
npx pg-checkup sql                # every query it runs
npx pg-checkup compare A B        # what was fixed, what is new

Web report

npx pg-checkup upload FILE

It shows what is in the file and asks first. The report adds the fix SQL, data tables, and a comparison with your last checkup. Only you can open it. npx pg-checkup delete RECEIPT removes it.

Workspace ($5 a month) keeps every report and adds PDF, a share link, upload tokens and email alerts. See GitHub and CI.

Watch it live

npx pg-checkup live postgres://USER@HOST:5432/DBNAME

Refreshes every 2 seconds until Ctrl-C:

  • Running: active queries, longest first, with their wait event
  • Blocked: sessions waiting on a lock, and which pid holds it
  • Idle in transaction: sessions holding locks and holding back vacuum
  • In progress: vacuum, analyze, index builds, COPY, base backups

--interval 5 changes the refresh. --once prints one screen. --json prints one object per refresh.

Options for scripts

Option Effect
--json Result as JSON on stdout; messages on stderr
--md Result as Markdown on stdout
--fail-on critical|warning|info Exit 1 when a finding at that level or above exists
-o FILE Output file. Never overwrites
--no-input Never prompt
--omit-query-text Leave SQL text out of the file
--require-reader-role Exit 3 if the login can do more than read statistics

Exit codes: 0 done, 1 --fail-on match, 2 error, 3 login has too much access.

PreviousConnectingNextMigration checks