1
I need to make some changes to one of the tables to add new columns. The problem is that I cannot do it. I get the following error:
PG::Diskfull: ERROR: could not extend file "base/1672994/5557167.4": No space left on device. HINT: Check free disk space.
Well, there is no doubt that I need to increase my disk space, since not even an operation VACUUM FULL
worked, presenting this same problem.
To query what I tried to do is this:
ALTER TABLE messages ADD COLUMN readed BOOLEAN DEFAULT FALSE;
It’s a simple field, and Boolean doesn’t take up much space. But reading on other forums, I saw something related to the fact that PG needs more space to do an operation like this. I’m not sure how it works, but this table I’m trying to change has over 6,700,000 lines, and taking that into account, it might make sense that the current space isn’t enough for the operation.
But anyway. What I want to know is: Is there a way that I can calculate on average how much extra space I’ll need to buy for this operation to work? And how does this question of ALTER TABLE
? It really takes a lot more room to work?
I understand that as Postgresql uses MVCC (Multiversion Concurrency Control) it will generate a copy of the entire table by adding the new field, and only at the end remove the old table. Maybe a pg_dumpall (on another storage medium), modify the table definition in the generated file, delete the database and recreate it so psql can be a solution.
– anonimo