Re: Please help me understand unlogged tables

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Please help me understand unlogged tables
Дата
Msg-id CAMkU=1zw1_PWL-P7kaCBeC8ePGCvQTjPDZ=8O5y8Awb7qm_nMA@mail.gmail.com
обсуждение исходный текст
Ответ на Please help me understand unlogged tables  (Alexander Stoddard <alexander.stoddard@gmail.com>)
Список pgsql-general
On Wed, Jan 31, 2018 at 8:52 AM, Alexander Stoddard <alexander.stoddard@gmail.com> wrote:
If a table is set to unlogged is it inherently non-durable? That, is any crash or unsafe shutdown _must_ result in truncation upon recovery?

Yes.
 
I can imagine a table that is bulk loaded in a warehousing scenario and then sitting statically could be safe, but maybe the question becomes how could the system know it is unchanged if it isn't logged...

Right, that is the problem.  It would be nice to solve it, but there are no immediate plans that I know of to implement that.  It is hard, because during recovery the system can't query system catalog tables to get information out of them.  That is why unlogged tables are indicate by the existence of certain files in the filesystem, so the system can know they are unlogged without querying the system catalogs to find out.
 
Would a correct solution be to bulk load into an unlogged table and then (fairly cheaply?) set the table back to being logged?

Unfortunately, it is not cheap for large tables.

I have some large datasets which I could always regenerate if needed, which I don't want blowing out my wal archive.  I've resigned myself to just reloading them after a crash (or after using pg_basebackup to reclone production to make a fresh test/dev server).  If the ETL step from the raw source is expensive, then I \copy the table out to a file, and then \copy it back in after a crash, to save on the ET time.
  

Cheers,

Jeff

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

Предыдущее
От: Michał Muskała
Дата:
Сообщение: Unexpected ErrorMessage reply to SSLRequest
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Please help me understand unlogged tables