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

From Tom Lane
Subject Re: Why does PostgreSQL ftruncate before unlink?
Date
Msg-id 5141.1393214856@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why does PostgreSQL ftruncate before unlink?  (Jon Nelson <jnelson+pgsql@jamponi.net>)
Responses Re: Why does PostgreSQL ftruncate before unlink?  (Jon Nelson <jnelson+pgsql@jamponi.net>)
List pgsql-general
Jon Nelson <jnelson+pgsql@jamponi.net> writes:
> On Sun, Feb 23, 2014 at 9:49 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> If memory serves, the inode should get removed during the next checkpoint.

> I was moments away from commenting to say that I had traced the flow
> of the code to md.c and found the comments there quite illuminating. I
> wonder if there is a different way to solve the underlying issue
> without relying on ftruncate (which seems to be somewhat expensive).

Hm.  The code is designed the way it is on the assumption that ftruncate
doesn't do anything that unlink wouldn't have to do anyway.  If it really
is significantly slower on popular filesystems, maybe we need to revisit
that.

            regards, tom lane


pgsql-general by date:

Previous
From: Jon Nelson
Date:
Subject: Re: Why does PostgreSQL ftruncate before unlink?
Next
From: Felix.徐
Date:
Subject: How to convert a double value to a numeric datum type in pgsql?