---
title: "Disk Usage"
description: "What occupies the disk of a Managed PostgreSQL service besides your rows: indexes, WAL, replication slots, temporary files and dead rows."
url: https://community.exoscale.com/product/dbaas/service-specific/postgresql/overview/disk-usage/
product: "PostgreSQL"
section: product
last_updated: 2026-11-10
---
> For AI agents: the documentation index is at https://community.exoscale.com/llms.txt. Every page is available as markdown at `<page URL>index.md` or with `Accept: text/markdown`.

# Disk Usage

This page explains what occupies the disk of a Managed PostgreSQL service besides the rows you store, and how each part is measured and kept in check.

## The Disk Comes with the Plan

Each plan has a fixed disk size, for example 80 GiB on `startup-4` and 8 GiB on `hobbyist-2`. List
the plans with `exo dbaas type show pg --plans`, and read the size of a service, in bytes, with:

```bash
exo api get-dbaas-service-pg SERVICE_NAME -z ZONE -q '"disk-size"'
```

The share in use is the `disk_usage` metric, a percentage, returned by
`exo dbaas metrics SERVICE_NAME -z ZONE --period day`. To get more disk, move to a larger plan, see
[Change the service plan](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/change-the-plan/index.md).

## What Is on the Disk

| Consumer | What it is | Grows when |
| --- | --- | --- |
| Tables and TOAST | Rows, with large values compressed and stored out of line | You store data |
| Indexes | One separate structure per index | You add indexes or rows |
| WAL | The write-ahead log, kept until archived and no longer needed | You write, or a replication slot holds it |
| Dead rows | Old row versions left by `UPDATE` and `DELETE` | Vacuum does not keep up, or a long transaction prevents cleanup |
| Temporary files | Sorts, hashes and index builds that do not fit in memory | Large queries or index builds run |

Only the first two are your data. The size functions such as `pg_database_size()` count tables,
indexes and dead rows, not WAL or temporary files, so the sum of your database sizes is always
lower than what the disk metric shows. How to measure each relation is described in
[Check object sizes](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/check-object-sizes/index.md).

## WAL

Every change is written to the WAL before it reaches the table files. The service archives WAL
continuously for backups and point-in-time recovery, and keeps a part of it on disk:

```sql
SHOW wal_keep_size;
SHOW max_wal_size;
SHOW archive_timeout;
```

`wal_keep_size` and `max_wal_size` depend on the plan, so a part of the disk is always taken by WAL,
even on a quiet service. `archive_timeout` (5 minutes) makes PostgreSQL switch to a new WAL segment
at least that often so that it can be archived.

## Replication Slots

A replication slot guarantees that the WAL its consumer still needs stays on disk. When the
consumer stops, for example a logical replication subscriber or a CDC tool that was switched off,
the slot keeps every new WAL segment and disk usage grows independently of your data. A slot left
behind by a consumer that is gone is one of the main causes of unexplained disk growth.

The `pghoard_local` slot belongs to the platform's backup and WAL archiver; it is always present and
must not be dropped. The number of slots is limited by `max_replication_slots`, `20` by default,
configurable from `8` to `256`. The WAL one slot may keep is unlimited by default and can be
capped with `max_slot_wal_keep_size`: a slot over the limit is invalidated, which breaks that
replication but protects the disk.

To list slots, see how much WAL each one retains, and set the cap, see
[Prevent a full disk](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/prevent-full-disk/index.md#find-wal-held-back-by-a-replication-slot).

## Temporary Files

A sort, hash join or hash aggregate that needs more than `work_mem` writes temporary files, and so
does an index build that needs more than `maintenance_work_mem`. They are deleted when the operation
ends, but while it runs, a single query can write gigabytes. `temp_file_limit` is `-1` on a new
service, which means no limit. Setting it turns a disk filled by one query into one failed query.
See [Prevent a full disk](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/prevent-full-disk/index.md#limit-temporary-files).

## Dead Rows and Bloat

PostgreSQL never overwrites a row: `UPDATE` writes a new version and `DELETE` marks the old one
dead. `VACUUM`, run automatically by autovacuum, makes the space of dead rows reusable by the same
table, but in general does not give it back to the file system. A table that was heavily updated
or emptied with `DELETE` therefore keeps its size.

Space returns to the disk only when files are removed or rewritten: `TRUNCATE`, `DROP`, `REINDEX`,
`VACUUM FULL` or `pg_repack`. The last three write a complete new copy before removing the old
one, so they need free space about the size of what they rebuild.

## Plan Ahead

Several of the operations that free space need free space, and a plan change takes time. Alert on
the disk metric well before it is full, and choose a plan with room for WAL, temporary files,
dead rows and index rebuilds in addition to the data.

## Related Pages

- [Prevent a full disk on Managed PostgreSQL](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/prevent-full-disk/index.md)
- [Check object sizes](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/check-object-sizes/index.md)
- [Shared buffers and memory](https://community.exoscale.com/product/dbaas/service-specific/postgresql/overview/shared-buffers/index.md)
- [Backups and point-in-time recovery](https://community.exoscale.com/product/dbaas/service-specific/postgresql/overview/backups-and-pitr/index.md)
- [Change the service plan](https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/change-the-plan/index.md)

