Re: PG and undo logging - Mailing list pgsql-general

From Ravi Krishna
Subject Re: PG and undo logging
Date
Msg-id CACER=P3QOkXGcVK0FkzF6NrYoEE1tOhMFktxB1MGg_61fY=LRQ@mail.gmail.com
Whole thread Raw
In response to Re: PG and undo logging  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: PG and undo logging
List 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.g.johnston@gmail.com> wrote:
> On Sat, May 23, 2015 at 1:34 PM, Ravi Krishna <sravikrishna3@gmail.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.
>


pgsql-general by date:

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