Answer the question
In order to leave comments, you need to log in
How to clear data in PostgreSQL tables to free up disk space?
Good day!
The situation is this: there is a database (psql), which in a month swells up to 100GB, due to the large amount of data (for a month in total about 1 billion rows in tables). Hard disk space is limited. After the database gobbled up all the free space, I couldn’t do something with it - the psql service does not start, but by deleting something from the data folder (there is no free space on the machine and nothing can be deleted except the database) - the base is not restored. But that's not the point. How can I clean up data in tables for a certain period with REAL freeing up disk space? The fact is that I performed a DELETE for all tables, deleting records older than a week (before that there were records for 3 weeks), after which I performed a VACUUM for the entire database. After these very long operations, -500Mb was released. It is with a minus sign. ABSOLUTELY NOTHING was released, quite the contrary.
PS: I used to work with Microsoft SQL, I never encountered such problems there...
Answer the question
In order to leave comments, you need to log in
The first link in Google leading to the documentation:
Further, a more preferable alternative to VACUUM FULL: habrahabr.ru/post/169939
It is worth doing a full vacuum, but again it requires a lot of space, that is, if there is no space left at all, then it will not be able to pass normally.
It is logical to copy-paste the database to another server where there are no problems with the place.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question