drop table but file still exists

Started by Luca Ferrarialmost 17 years ago3 messagesgeneral
Jump to latest
#1Luca Ferrari
fluca1978@infinito.it

Hi,
I'm just curious to know why after a drop table the disk file is emptied but
still existent. What is the reason why the file is not deleted immediately?

Thanks,
Luca

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Luca Ferrari (#1)
Re: drop table but file still exists

Luca Ferrari <fluca1978@infinito.it> writes:

I'm just curious to know why after a drop table the disk file is emptied but
still existent. What is the reason why the file is not deleted immediately?

It's protecting against some obscure race condition involving
reassignment of the relfilenode number to a new table.  I forget the
details but you could troll the archives for it if you really care
--- I think we put that in about two or so years ago.

regards, tom lane

#3Simon Riggs
simon@2ndQuadrant.com
In reply to: Luca Ferrari (#1)
Re: drop table but file still exists

On Fri, 2009-05-15 at 09:09 +0200, Luca Ferrari wrote:

I'm just curious to know why after a drop table the disk file is emptied but
still existent. What is the reason why the file is not deleted immediately?

To avoid various problems the files are removed after the next
checkpoint.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support