I’m trying to write a query that is going to be updating a lot of rows but I keep hitting
ERROR: could not write to file "base/pgsql_tmp/pgsql_tmp441.1627": No space left on device
I imagine that this is because I don’t have enough space in my docker container but all of this is new to me so I’m not really sure if there is something obvious I’m missing. How would I go about seeing how much space I currently have and how would I increase it?
This is my docker compose file
version: "3"
services:
db-15:
image: postgres:15
ports:
- "55432:5432"
volumes:
- app-db-data:/var/lib/postgresql/data/pgdata
environment:
POSTGRES_HOST_AUTH_METHOD: "trust"
PGDATA: "/var/lib/postgresql/data/pgdata"
POSTGRES_USER: postgres
POSTGRES_PASSWORD: mypassword
POSTGRES_DB: postgres
db-13:
image: postgres:13
ports:
- "55433:5432"
volumes:
- app-db-data-13:/var/lib/postgresql/data/pgdata
environment:
POSTGRES_HOST_AUTH_METHOD: "trust"
PGDATA: "/var/lib/postgresql/data/pgdata"
POSTGRES_USER: postgres
POSTGRES_PASSWORD: mypassword
POSTGRES_DB: postgres
volumes:
app-db-data:
app-db-data-13:
2
Answers
Typically when I hit the
no space left on device
issue for Docker its because I have too many images, volumes etc. on my local machine and I need to clear things up by running adocker system prune
like mentioned in here:https://forums.docker.com/t/docker-no-space-left-on-device/69205/4
or
Docker error : no space left on device
You are running a bad SQL statement that writes enough temporary files to fill your disk. You should set the PostgreSQL parameter
temp_file_limit
to something that is way less than the amount of free space on your file system.But that won’t fix the cause of the problem, it will only prevent you from running out of disk space, which is not a good condition for a relational database. You will have to fix the statement the generates that many temporary files — perhaps you forgot a join condition or two?