Re: literature on write-ahead logging

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: literature on write-ahead logging
Date: 2011-06-09 14:34:47
Message-ID: 1307629991-sup-4487@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Robert Haas's message of jue jun 09 10:28:39 -0400 2011:
> On Thu, Jun 9, 2011 at 10:22 AM, Alvaro Herrera
> <alvherre(at)commandprompt(dot)com> wrote:
> >> 1. Subdivide XLOG insertion into three operations: (1) allocate space
> >> in the log buffer, (2) copy the log records into the allocated space,
> >> and (3) release the space to the buffer manager for eventual write to
> >> disk.  AIUI, WALInsertLock currently covers all three phases of this
> >> operation, but phase 2 can proceed in parallel.  It's pretty easy to
> >> imagine maintain one pointer that references the next available byte
> >> of log space (let's call this the "next insert" pointer), and a second
> >> pointer that references the byte following the last byte known to be
> >> written (let's call this the "insert done" pointer).
> >
> > I think this can be done more simply if instead of a single "insert
> > done" pointer you have an array of them, one per backend; there's also a
> > global pointer that can be advanced per the minimum of the bunch, which
> > you can calculate with some quick locking of the array.  You don't need
> > to sleep at all, except to update the array and calculate the global
> > ptr, so this is probably also faster.
>
> I think looping over an array with one entry per backend is going to
> be intolerably slow... but it's possible I'm wrong.

Slower than sleeping? Consider that this doesn't need to be done for
each record insertion, only when you need to flush (maybe more than
that, but I think that's the lower limit).

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-06-09 14:36:59 Re: Autoanalyze and OldestXmin
Previous Message Robert Haas 2011-06-09 14:32:27 Re: Parameterized aggregate subquery (was: Pull up aggregate subquery)