pg_unused_indexes
Find never-scanned or rarely used PostgreSQL indexes that waste disk and slow writes. Drop them before adding new ones; primary keys and unique constraints are excluded.
Instructions
Indexes that have never been scanned or have very low usage. Each unused index costs write amplification (every INSERT/UPDATE maintains it) and disk space. Excludes primary keys and unique constraints (which are load-bearing even with zero scans). Use this before adding new indexes - sometimes the fix is to drop a dead one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max rows to return (default 50). | |
| schema | No | Limit to one schema. If omitted, all user schemas are included. | |
| maxScans | No | Include indexes with scan count <= this (default 10). Use 0 for 'never scanned'. |