pg_unused_indexes
Identify unused or low-usage indexes that waste write amplification and disk space. Drop them to optimize database performance.
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'. |