Re: Proposal for unlogged tables

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Proposal for unlogged tables
Дата
Msg-id 20160104161234.GE28025@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: Proposal for unlogged tables  (Mark Zealey <mark@allaroundtheworld.fr>)
Ответы Re: Proposal for unlogged tables  (Mark Zealey <mark@allaroundtheworld.fr>)
Список pgsql-performance
On 2016-01-04 16:38:40 +0200, Mark Zealey wrote:
> I don't know how the internals work but unlogged tables definitely flushed
> to disk and persist through normal server restarts. It is just according to
> the docs if the server ever has an unclean shutdown the tables are truncated
> even if they have not been updated in a year. I can't understand why it has
> to be like this and it seems that it would be much nicer to not
> automatically truncate if it doesn't have to.

Pages containing data of unlogged tables aren't ever flushed to disk
unless
a) a shutdown checkpoint is performed
b) a buffer containing data from an unlogged table is used for something
   else
c) the database being copied is the the source of a CREATE DATABASE .. TEMPLATE

Hence, if there's an unclean shutdown, there's absolutely no guarantee
about the on-disk state of unlogged tables. Even if they haven't been
modified in ages - there could have been many many dirty pages in shared
buffers when crashing.


Always flushing dirty pages of unlogged tables at checkpoint would
greatly increase the overhead for memory resident, write heavy workloads
that use unlogged tables.

Andres


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

Предыдущее
От: Mark Zealey
Дата:
Сообщение: Re: Proposal for unlogged tables
Следующее
От: Mark Zealey
Дата:
Сообщение: Re: Proposal for unlogged tables