Re: including PID or backend ID in relpath of temp rels - Mailing list pgsql-hackers

From Greg Stark
Subject Re: including PID or backend ID in relpath of temp rels
Date
Msg-id AANLkTim86spaOfHm9eTu6JspQWj-NcADdq8bIS5sMSwc@mail.gmail.com
Whole thread Raw
In response to Re: including PID or backend ID in relpath of temp rels  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, May 4, 2010 at 5:17 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> FWIW, that's not the case, anymore than it is for blocks in shared
> buffer cache for regular rels.  smgrextend() results in an observable
> extension of the file EOF immediately, whether or not you can see
> up-to-date data for those pages.
>
> Now people have often complained about the extra I/O involved in that,
> and it'd be nice to have a solution, but it's not clear to me that
> fixing it would be harder for temprels than regular rels.

For systems that have it and filesystems that optimize it I think
posix_fallocate() handles this case. We can extend files without
actually doing any i/o but we get the guarantee from the filesystem
that it has the space available and writing to those blocks won't fail
due to lack of space. Only meta-data i/o is triggered allocating the
blocks and marking them as virtually filled with nulls and it's not
synced unless there's an fsync so there's no extra physical i/o.

This should be the case for ext4 but I'm not sure what other
filesystems implement this.


--
greg


pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Stefan's bug (was: max_standby_delay considered harmful)
Next
From: Bruce Momjian
Date:
Subject: Re: pg_upgrade and extra_float_digits