Check free space / usage ratio
Oracle
SELECT df.tablespace_name,
ROUND(SUM(df.bytes)/1024/1024) AS total_mb,
ROUND(NVL(fs.free, 0)/1024/1024) AS free_mb,
ROUND((1 - NVL(fs.free,0)/SUM(df.bytes)) * 100, 1) AS pct_used
FROM dba_data_files df
LEFT JOIN (SELECT tablespace_name, SUM(bytes) free
FROM dba_free_space GROUP BY tablespace_name) fs
ON df.tablespace_name = fs.tablespace_name
GROUP BY df.tablespace_name, fs.free;For files with AUTOEXTEND on, the real limit is maxbytes; check dba_data_files.maxbytes for MAXSIZE.
PostgreSQL
-- Datafile usage is at the OS level (df -h). Tablespace sizes from inside the DB:
SELECT spcname, pg_size_pretty(pg_tablespace_size(spcname))
FROM pg_tablespace;PostgreSQL relies on the OS for free disk space; operating system monitoring (df) is essential for critical thresholds.
MySQL
SELECT table_schema,
ROUND(SUM(data_free)/1024/1024, 1) AS reclaimable_mb
FROM information_schema.tables
GROUP BY table_schema;data_free is reclaimable (fragmented) space inside the table; free disk space is at the OS level.
SQL Server
SELECT name AS file_name,
size/128.0 AS size_mb,
size/128.0 - CAST(FILEPROPERTY(name,'SpaceUsed') AS int)/128.0 AS free_mb
FROM sys.database_files;SpaceUsed is in pages; dividing by 128 gives MB (8 KB pages).
MongoDB
var s = db.stats();
({ fsTotalGB: +(s.fsTotalSize/1073741824).toFixed(1),
fsUsedGB: +(s.fsUsedSize/1073741824).toFixed(1) })With WiredTiger, fsTotalSize / fsUsedSize give the total and used size of the disk at the OS level.
Redis
INFO memory
CONFIG GET maxmemory
# Usage = used_memory / maxmemoryIf maxmemory is 0 there is no limit, and when RAM fills up the OS OOM killer steps in. maxmemory-policy determines eviction behavior.