Re: Unlogged tables cannot be truncated twice

From: Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Greg Sabino Mullane <greg(at)endpoint(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Unlogged tables cannot be truncated twice
Date: 2011-06-01 18:43:46
Message-ID: BANLkTi=MO0A79hVSmPLaY_tUowzo882n2w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

2011/6/1 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Tue, May 31, 2011 at 7:04 AM, Cédric Villemain
> <cedric(dot)villemain(dot)debian(at)gmail(dot)com> wrote:
>> Robert, I wonder if all the logic with INIT_FORK is only to simulate
>> truncate on server restart ?
>
> That is correct.
>
>> I failled to understand why not simply use truncate around the server
>> start (when it is in recovery).
>
> We need to do the equivalent of a truncate but without relying in any
> way on the system catalogs.  The startup process is not bound to a
> database, and starting a separate worker process for each database
> would be both very complicated and very expensive.
>
> Also note that while truncate is very simple for a table (just zero
> out the file) it's not so simple for an index (a zero-length file is
> an invalid index, not an empty one).
>
>> While here I also wonder why GiST unlogged are not supported ?!
>
> Because they use LSNs internally to guarantee proper synchronization,
> which presumes that WAL records are being omitted.  Temporary GIST
> indexes were broken too, for the same reason, but Heikki fixed that
> using GetXLogRecPtrForTemp().  We could engineer a similar solution
> for unlogged GIST indexes using a shared counter that is saved in
> pg_control across clean shutdowns, but I think that's a 9.2 project.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

All right, things under a new light!
Thank you.

--
Cédric Villemain               2ndQuadrant
http://2ndQuadrant.fr/     PostgreSQL : Expertise, Formation et Support

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Florian Pflug 2011-06-01 19:56:25 Re: [BUGS] BUG #6034: pg_upgrade fails when it should not.
Previous Message Robert Haas 2011-06-01 18:34:45 Re: BUG #6042: unlogged table with Streaming Replication