Why does PostgreSQL ftruncate before unlink?

From: Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Why does PostgreSQL ftruncate before unlink?
Date: 2014-02-21 23:14:29
Message-ID: CAKuK5J1YZZXp5KxbGn4AJhAbmfSUCcoFZmp4My+u6s7pgBB3Og@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

--
Jon

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Torsten Förtsch 2014-02-22 02:21:49 Re: How to continue streaming replication after this error?
Previous Message Brian Crowell 2014-02-21 21:12:39 Re: GSSAPI server side on Linux, SSPI client side on Windows