Re: unlogged tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14/11/11 10:08, Sergey Konoplev wrote:
On 14 November 2011 12:58, Richard Huxton<dev@xxxxxxxxxxxx>  wrote:
Because they bypass the transaction-log (WAL), hence unlogged.
There's no way to know whether there were partial updates applied when the
system restarts.

I probably did not understand the "truncate" meaning correct. It
truncates all the records of the table or several recent records only?

All.

Let's say you were doing something like "UPDATE unlogged_table SET x=1 WHERE y=2". If a crash occurs during this command, there's no guarantee that the affected disk pages were all updated. Worse, a single page might be partially updated or even have rubbish in it (depending on the nature of the crash).

Without the WAL there's no way to check whether the table is good or not, or even to know what the last updates were. So - the only safe thing to do is truncate the unlogged tables.

In the event of a normal shutdown, we can flush all the writes to disk so we know all the data has been written, so there is no need to truncate.

--
  Richard Huxton
  Archonet Ltd

--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux