Monitoring disk space from within the server

From: Christoph Berg <myon(at)debian(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Monitoring disk space from within the server
Date: 2019-11-08 13:24:19
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Monitoring the available disk space is the topmost thing on the
priority for PostgreSQL operation, yet this metric is not available
from the SQL level.

The attached patch implements a function pg_tablespace_statfs(tblspc)
to report disk space numbers per tablespace:

# select * from pg_tablespace_statfs('pg_default');
blocks │ bfree │ bavail │ files │ ffree
103179564 │ 20829222 │ 20815126 │ 26214400 │ 24426295

Open points:
* should these numbers be converted to bytes?
* the column names currently mirror the statfs() names and should
certainly be improved
* which of these columns add to \db+ output?
* possibly extend this (and \db) to pg_wal


Attachment Content-Type Size
0001-Add-pg_tablespace_statfs-functions.patch text/x-diff 5.2 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2019-11-08 13:31:07 Re: Why overhead of SPI is so large?
Previous Message Grigory Smolkin 2019-11-08 13:08:47 Re: [proposal] recovery_target "latest"