Re: Unlogged tables cannot be truncated twice

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Unlogged tables cannot be truncated twice
Дата
Msg-id BANLkTi=3Te64x4QEXuoVv-dj=VKhOqVGMQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Unlogged tables cannot be truncated twice  (Cédric Villemain <cedric.villemain.debian@gmail.com>)
Ответы Re: Unlogged tables cannot be truncated twice  (Cédric Villemain <cedric.villemain.debian@gmail.com>)
Список pgsql-bugs
On Tue, May 31, 2011 at 7:04 AM, C=E9dric Villemain
<cedric.villemain.debian@gmail.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.

--=20
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: BUG #5903: Turkish encoding problem
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Unlogged tables cannot be truncated twice