why the DB file size does not reduce when 'delete' the data in DB?

Started by Jaruwan Laongmalalmost 25 years ago3 messages
#1Jaruwan Laongmal
jaruwan@gits.net.th

I had deleted a very large number of records out of my SQL table in order to
decrease the harddisk space. But after I use command 'ls -l
/usr/local/pgsql/data/base/', it is found that the size of concerning files
do not reduce due to the effect of 'delete' SQL command. What should I do
if I would like to decrease the harddisk space?

I am looking forward to your response. Thank you very much for any help.
-
Jaruwan

#2Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: Jaruwan Laongmal (#1)
Re: [HACKERS] why the DB file size does not reduce when 'delete' the data in DB?

I had deleted a very large number of records out of my SQL table in order to
decrease the harddisk space. But after I use command 'ls -l
/usr/local/pgsql/data/base/', it is found that the size of concerning files
do not reduce due to the effect of 'delete' SQL command. What should I do
if I would like to decrease the harddisk space?

Run "vacuum" from SQL or "vacuumdb" from the command line. Tables will
be reduced in size, though currently indices are not.

- Thomas

#3Hannu Krosing
hannu@tm.ee
In reply to: Jaruwan Laongmal (#1)
Re: [HACKERS] why the DB file size does not reduce when 'delete' the data in DB?

Jaruwan Laongmal wrote:

I had deleted a very large number of records out of my SQL table in order to
decrease the harddisk space. But after I use command 'ls -l
/usr/local/pgsql/data/base/', it is found that the size of concerning files
do not reduce due to the effect of 'delete' SQL command. What should I do
if I would like to decrease the harddisk space?

Run the command VACUUM;

This will do the actual removal of deleted records. DELETE just marks
them as deleted

Show quoted text

I am looking forward to your response. Thank you very much for any help.
-
Jaruwan