I have a PostgreSQL database on a docker container with 50MB of data:
SELECT pg_size_pretty(pg_database_size('db_1'));
pg_size_pretty
------------------
50 MB
but the volume size is 8.5GB :
sudo du -hd1 db_volume
8.5G db_volume
and my docker-compose is like this:
version: '3.8'
services:
r3-db:
image: postgres:12
restart: always
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: PASSWORD
POSTGRES_USER: USER
POSTGRES_DB: db_1
volumes:
- ./db_volume/:/var/lib/postgresql/data:Z
I try using VACUUM(FULL, ANALYZE, VERBOSE)
on any table but the file size of the database doesn't change!
The volume contains many files named core.NUMBER
with size of 145MB,
How can I reduce disk usage of the database?