Shailesh Tainwala
Shailesh Tainwala

Reputation: 6507

Unable to reclaim space on PostgreSQL database

I have a database that had several tables full of thousands of rows of data. I used the 'delete from _' command to empty all of them as lack of space on the machine was preventing me from creating additional tables.

However, the data from the tables is gone, but there is still insufficient space on the system. Any additional commands to make sure the data is completely removed? I have already executed commit, so that cannot be the issue here.

Thanks to all responders.

Upvotes: 2

Views: 4568

Answers (2)

megothss
megothss

Reputation: 86

If you want to erase all the data from the tables, instead of DELETE FROM _ you should use the command:

TRUNCATE TABLE tablename;

The command truncate reclaims disk space immediately, but there are a few caveats that you should be aware of.

You can find further information at: http://www.postgresql.org/docs/9.1/static/sql-truncate.html

Upvotes: 3

Milen A. Radev
Milen A. Radev

Reputation: 62593

"Recovering Disk Space"

Upvotes: 7

Related Questions