View pg_bloat_info
Creates a view to monitor table bloat. Partitioned tables are excluded as they do not contain data and therefore are not affected by bloat, the partitions are included as they are tables.
Columns
| Column Name | datatype | Description |
|---|---|---|
| type | text | Object type, can be table or index. |
| schemaname | name | The schema where the object is located. |
| object_name | name | The name of the table or index. |
| bloat | numeric | The estimated bloat ratio. |
| waste | text | The estimated wasted disk spae with unit (kB, MB, GB). |
Example
SELECT *
FROM pg_bloat_info;
Result:
| type | schemaname | object_name | bloat | waste |
|---|---|---|---|---|
| table | timetravel | timetravel_2024 | 1.5 | 8712 kB |
| table | timetravel | timetravel_pk | 1.0 | 16 kB |
| index | timetravel | timetravel_2024::timetravel_2024_changed_idx | 1.0 | 0 bytes |
| index | timetravel | timetravel_pk::timetravle_pk_pk | 0.8 | 0 bytes |
| index | timetravel | timetravel_2024::timetravel_2024_timetravelid_idx | 0.3 | 0 bytes |
| index | timetravel | timetravel_2024::timetravel_2024_deleted_idx | 0.1 | 0 bytes |