pg_advisor
Run a DBA lint check to identify sequence exhaustion risks, tables missing primary keys, and public tables with row-level security disabled. Get actionable findings sorted by category.
Instructions
Rolled-up DBA lint pass. One call returns three categories of findings:
sequence_exhaustion: SERIAL / BIGSERIAL / IDENTITY sequences whose
last_valueis aboveseqExhaustionThresholdofmax_value. The classic incident class.tables_without_primary_key: user tables (plain and partitioned) with no PK defined. Bloat candidates and a sign of design drift; some replication setups also need PKs. Foreign tables are excluded -- PostgreSQL forbids declaring PKs on foreign tables.
public_tables_without_rls: tables in
public(or any schema inrlsSchemas) with row-level security disabled. Useful as a security baseline check. Use this as the 'what should I be looking at?' starting point, then drill intopg_unused_indexes,pg_table_bloat,pg_seq_scan_tablesfor the perf side.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max rows per category (default 50). | |
| rlsSchemas | No | Schemas where RLS-missing should be flagged. Defaults to ['public']. | |
| seqExhaustionThreshold | No | Minimum used-fraction (last_value / max_value) to flag a sequence (default 0.5 = 50%). |