Re: Logical to physical page mapping

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Logical to physical page mapping
Date: 2012-10-28 22:35:19
Message-ID: 508DB327.6000805@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/27/2012 2:41 PM, Heikki Linnakangas wrote:
> And it's not at all
> clear to me that it would perform better than full_page_writes. You're
> writing and flushing out roughly the same amount of data AFAICS.

I think this assumption is wrong. full_page_writes=on means we write the
full page content to WAL on first change after a checkpoint. A change
after a checkpoint logically means that the same page is dirty now and
must also be written latest during the next checkpoint, which means 16K
written minimum for every page changed after a checkpoint.

> What exactly is the problem with full_page_writes that we're trying to
> solve?

Full page writes are meant to guard against torn pages. That is the case
when an 8K page is written by the underlying OS/filesystem/HW in smaller
chunks (for example 512 byte sectors), and in the case of a crash some
of these chunks make it, others don't. Without full_page_writes, crash
recovery can work if all 8K made it, or nothing made it (aka atomic
writes). But it will fail otherwise.

The amount of WAL generated with full_page_writes=on is quite
substantial. For pgbench for example the ratio 20:1. Meaning with
full_page_writes you write 20x the amount you do without.

Jan

--
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-10-28 22:47:16 Re: foreign key locks
Previous Message David Lee 2012-10-28 22:34:23 Re: Creating indexes in the background