DELETE TABLE xx do not erase index file after a vacuum full ?

Started by Hervé Piedvachealmost 22 years ago3 messagesgeneral
Jump to latest
#1Hervé Piedvache
herve@elma.fr

Bug or problem with PostgreSQL ?

version
---------------------------------------------------------------
PostgreSQL 7.4.3 on i686-pc-linux-gnu, compiled by GCC 2.95.4

select * from my_table;
id | login | passwd | state | email
--------------+-----------+------------+-------+------------------
(0 rows)

I had before about 800 000 lines inside ...

I have done a :
DELETE from my_table;

Now If I look at the data/bases/ folder I see that I still have a 35 Mb file
for one of the index of this table ... ???

VACUUM FULL VERBOSE ANALYSE; have been done on this table before, but I still
have for this index this message :

INFO: index "email_my_table_key" now contains 2 row versions in 4313 pages
DETAIL: 0 index row versions were removed.
4309 index pages have been deleted, 4309 are currently reusable.
CPU 0.01s/0.01u sec elapsed 0.02 sec.

What happend ? Why the index file is still here ?

Thanks for your help !
--
Hervᅵ Piedvache

Elma Ingᅵnierie Informatique
6 rue du Faubourg Saint-Honorᅵ
F-75008 - Paris - France
Pho. 33-144949901
Fax. 33-144949902

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hervé Piedvache (#1)
Re: DELETE TABLE xx do not erase index file after a vacuum full ?

=?iso-8859-15?q?Herv=E9_Piedvache?= <herve@elma.fr> writes:

I have done a :
DELETE from my_table;

TRUNCATE would serve you a lot better.

For major reductions in table size VACUUM FULL is not the best tool;
you really want to reconstruct the indexes from scratch. Consider
REINDEX, CLUSTER, or (in this case) TRUNCATE.

regards, tom lane

#3Hervé Piedvache
herve@elma.fr
In reply to: Tom Lane (#2)
Re: DELETE TABLE xx do not erase index file after a vacuum full ?

Tom,

Le jeudi 1 Juillet 2004 19:22, Tom Lane a ᅵcrit :

=?iso-8859-15?q?Herv=E9_Piedvache?= <herve@elma.fr> writes:

I have done a :
DELETE from my_table;

TRUNCATE would serve you a lot better.

Impossible for this table because it's used by another table with a
referential integrity ... so truncate is refused ...

For major reductions in table size VACUUM FULL is not the best tool;
you really want to reconstruct the indexes from scratch. Consider
REINDEX, CLUSTER, or (in this case) TRUNCATE.

OK Thanks REINDEX is perfect ! ;o)

regards,
--
Hervᅵ Piedvache

Elma Ingᅵnierie Informatique
6 rue du Faubourg Saint-Honorᅵ
F-75008 - Paris - France
Pho. 33-144949901
Fax. 33-144949902