Re: PG and undo logging

From: Ravi Krishna <sravikrishna3(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: PG and undo logging
Date: 2015-05-23 21:37:53
Message-ID: CACER=P3QOkXGcVK0FkzF6NrYoEE1tOhMFktxB1MGg_61fY=LRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

undo means that reading the WAL logs and able to rollback a row back
to its original state before the update. Typically it is used to
rollback a long running transaction which got aborted due to a crash.
Here is an example:

2.pm You kick off a huge transaction to update say 1 million rows.
between 2.01 pm and 2.05pm, the db did multiple checkpoints.
2.06pm - machine crashed.

Note that at 2.06, your transaction of 2pm was still running. So when
the db starts later on, after redoing all transactions from the last
checkpoint @2.05pm till the time of crash 2.06pm, it also has to
rollback the 2pm update also because it never got completed. This
means, the rollback will have to go past several check points (between
2.01pm and 2.05pm).

Hope this explains it clearly.

On Sat, May 23, 2015 at 4:48 PM, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Sat, May 23, 2015 at 1:34 PM, Ravi Krishna <sravikrishna3(at)gmail(dot)com>
> wrote:
>>
>> Is it true that PG does not log undo information, only redo. If true,
>> then how does it bring a database back to consistent state during
>> crash recovery. Just curious.
>
>
> What does "undo" mean?
>
> David J.
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-05-23 21:42:05 Re: Re: Server tries to read a different config file than it is supposed to
Previous Message Daniel Begin 2015-05-23 21:23:21 Re: FW: Constraint exclusion in partitions