Postgres Storage Tab
When you open the Performance Analyzer on your DataDios data source (the datadios_self data source), the Postgres Storage tab shows where the space of your DataDios Postgres database goes and which part of it looks wasted. It draws on two metric groups, DD PG Storage Family and DD PG Storage Objects. Each takes one snapshot a day, so the tab changes once a day.
All sizes on this tab are estimates, except the sizes in Biggest Objects. Estimates are counted from page counts, not read from disk, so they can be a little off.
Who can fill and see the tab
- Collection is opt-in. Both metric groups are in the Ops category, which is off by default. Only a Privileged user (a platform admin) can turn Ops collection on for the source.
- Only the DataDios source of your own instance is read, and only your own tenant's schema. Other tenants are never read.
- Only a Privileged user sees the tab. Other users do not get it in the Performance Analyzer.
Until Ops collection is on and the first daily snapshot has run, the tab has nothing to draw.
The views
| View | Shape | What it shows |
|---|---|---|
| Where Space Goes (Top Families, Estimated) | Stacked bar chart | The 10 biggest table families, each split into Heap, Index and Toast |
| Growth Per Day (Top Families, Estimated) | Area chart, one series per family | Bytes added per day by the 10 biggest families. With one day of data it shows dots, not an area |
| Where It Is Wasted (Estimated) | Table | Nine rows, one for each kind of waste |
| Biggest Objects | Table | The biggest tables and indexes, and the unused and duplicate indexes, one row each. See Biggest Objects |
A table family is one table with all its partitions, or a plain table that has none. Toast is the separate storage Postgres uses for large values.
Where Space Goes, Where It Is Wasted and Biggest Objects use the latest snapshot in the date range you pick. Growth Per Day compares the biggest size of each day with the previous day that has a snapshot (averaged per day when days are missing), so it needs snapshots from at least two days. A family that shrank shows 0, not a negative number.
Where It Is Wasted
Each row gives a Count, a Size, a suggested What to do, and a Note when a number cannot be shown.
| Row | It counts | What to do |
|---|---|---|
| Total (estimated) | The sizes of the future, detached kept, unused, duplicate and stale rows added up. See Overlap | Fix the biggest rows first |
| Future partitions | Partitions that start more than 60 days from today | Lower premake (the number of partitions the partition manager creates ahead of time) |
| Empty partitions | Partitions that have already ended and either were never analyzed and have an empty file (0 bytes), or have 0 rows and at most 1 page. No size is shown | Drop the partition |
| Tables with no retention | Tables the partition manager keeps forever by accident: it has no retention set, and no maintenance policy says to keep every partition. When DataDios detach is switched off, every table counts as kept, so the row shows 0, not blank. No size is shown | Set a retention |
| Detached kept tables | Tables the partition manager detached from a partitioned table but did not drop. It keeps the table when its retention_keep_table setting is on | Drop or archive |
| Unused indexes | Indexes that were never scanned since the usage statistics started. Unique and exclusion indexes are never counted, because they enforce a rule. Invalid indexes are never counted. Indexes in stale and future partitions and in detached kept tables are left out, and so is a duplicate that is counted in the duplicate row | Drop the index |
| Indexes bigger than the table | Tables whose indexes take more pages than the table itself, and more than 1 MB | Review the indexes |
| Duplicate indexes | Valid indexes on the same table with the same access method, columns or expressions, operator class, collation, options, uniqueness and filter (WHERE clause). The copy kept is the one that backs a constraint (primary key, unique or exclusion), else one that is attached to a parent index of a partitioned table, else one that has been read, else the bigger one. The others are counted | Drop the duplicate |
| Stale partitions | Partitions whose start date is more than 183 days (about six months) before today and that have not been read in 183 days. A partition that was never read counts only once the statistics are 183 days old. On Postgres older than 16 the last read time is not available, so a partition that was read once and has been idle since is never counted | Archive or drop |
The size of a partition row covers the partition, its indexes and its toast storage.
Why Unused and Stale are blank for the first 7 days
Postgres counts index and table reads from the last statistics reset or server restart. Right after that the counts are near 0 and an index that is in use looks unused. So for the first 7 days the Unused indexes and Stale partitions rows show no numbers, and the Note says how old the statistics are. The Total row leaves them out and says so.
Why the partition-manager rows can be blank
Tables with no retention and Detached kept tables read the configuration of the Postgres partition manager (pg_partman). If it is not installed, or the database role DataDios uses cannot read it, both rows are blank and the Note says Partition manager is not installed or not readable. The Total row then leaves out the detached kept tables.
A snapshot taken before waste tracking existed shows Not collected for this snapshot on every row instead of zeros. A blank is never a zero: it means DataDios could not tell.
Overlap and estimates
- One object can be in several rows. For example a duplicate index can also be bigger than its table. The Total counts each byte once.
- Empty partitions, tables with no retention and indexes bigger than the table have no size in the total.
- Sizes are estimates from page counts.
If neither copy of a non-unique index was ever read and neither backs a constraint, both show as waste: the smaller one under Duplicate indexes, the bigger one under Unused indexes. Dropping both removes the index completely. Drop one only.
Biggest Objects
A table with one row for each table or index worth a look, so you can see which object to act on. It reads the DD PG Storage Objects group, from the same schema and with the same rules on who can see it. Unlike the waste table, its sizes are exact, not estimates.
| Column | What it shows |
|---|---|
| Schema | The schema of the object |
| Object | The table or index name |
| Kind | table or index |
| Family | The table family the object belongs to |
| Why Listed | top-size, unused, duplicate or oversize (see below) |
| Size | The exact size. A table counts its data and its toast storage, not its indexes. An index counts itself |
| Index Scans | How often an index was read. Blank for a table |
| Last Scan (days ago) | Days since an index was last read. Blank for a table, or when Postgres does not give the time |
| What To Do | A suggested step for the reason |
| Why listed | It lists | What to do |
|---|---|---|
| top-size | The 50 biggest tables and the 50 biggest indexes | Check whether the data is still needed, or can be archived or partitioned |
| oversize | A top-size index that is bigger than the data of its own table, and is itself over 1 MB | Review the index |
| unused | The 50 biggest indexes that were never scanned. Unique, primary key, exclusion and invalid indexes, indexes attached to a partitioned table's index, and indexes of detached kept tables are left out | Drop the index if nothing needs it |
| duplicate | The 50 biggest duplicate indexes: the copies that are not kept, as in Duplicate indexes. Unique, primary key, exclusion and attached indexes are left out | Drop the index |
- Up to 200 rows. An object that fits several reasons shows once, as duplicate first, then unused, then top-size or oversize. The table is sorted by Size, biggest first.
- Empty objects are not listed. An empty table, or a small index (64 KB or less) of one, is left out.
- Unused, Index Scans and Last Scan are blank for the first 7 days after the usage statistics started, for the reason given in Why Unused and Stale are blank for the first 7 days. A blank is never a zero.
- The table is drawn from the latest snapshot in the date range you pick.
Known limits
- This tab shows the DataDios source only. For a Postgres data source, see Storage Tab (Postgres).
- The suggestions are hints. Check a partition or an index before you drop it.