Thread: drop table but file still exists

drop table but file still exists

From
Luca Ferrari
Date:
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


Re: drop table but file still exists

From
Tom Lane
Date:
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

Re: drop table but file still exists

From
Simon Riggs
Date:
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