Re: Why does PostgreSQL ftruncate before unlink? - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Why does PostgreSQL ftruncate before unlink?
Date
Msg-id CAOR=d=16yT+mHuCaY0aBtHQURK5mAbxUYQMGJxUg+uYRdC1ktw@mail.gmail.com
Whole thread Raw
In response to Why does PostgreSQL ftruncate before unlink?  (Jon Nelson <jnelson+pgsql@jamponi.net>)
Responses Re: Why does PostgreSQL ftruncate before unlink?  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-general
On Fri, Feb 21, 2014 at 4:14 PM, Jon Nelson <jnelson+pgsql@jamponi.net> wrote:
> When dropping lots of tables, I noticed postgresql taking longer than
> I would have expected.
>
> strace seems to report that the largest contributor is the ftruncate
> and not the unlink. I'm curious what the logic is behind using
> ftruncate before unlink.
>
> I'm using an ext4 filesystem.

I'm guessing that this is so that it can be rolled back. Unlink is
likely issued at commit;


pgsql-general by date:

Previous
From: Haribabu Kommi
Date:
Subject: Re: How to continue streaming replication after this error?
Next
From: Torsten Förtsch
Date:
Subject: Re: How to continue streaming replication after this error?