Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 083D42E402D for ; Wed, 16 Jan 2008 19:27:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 73560-03 for ; Wed, 16 Jan 2008 19:27:35 -0400 (AST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.180]) by postgresql.org (Postfix) with ESMTP id 83AD72E00F7 for ; Wed, 16 Jan 2008 19:27:37 -0400 (AST) Received: by wa-out-1112.google.com with SMTP id m38so756248waf.5 for ; Wed, 16 Jan 2008 15:27:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=PqTnQFWSQtJJxu8dliZWpvqssw/DcFnB12s9Bd9IzcM=; b=VlD/+06SKOs3aCHO+8Q764GXuLClPsJHcHO5N1j0zLacEMHokXIDwGgcE4fzjVtNbNlg5cFFqfm9nbsAGjGjaUWzaZwbtuv/nb/oxt3jPAqKH07FEAPV8GS3QLB0TaxYH8k2QxFmrVTkGfdDLT1//v124xiDYBUYs64z7wqf/Gc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Br/8XZoWsaHGQZ6a8+EFDDqe1/J8lEk2zoVJTy0geAGfiQ1xnyVD2qBPkQkOAVvPOCS1psRjSjDloJrTYZ/fN1PLG8NouyCeJLbHVNhxmH5XPOgA25SA5o6PPmHxnNZzbbu1Kzyp3ToTvVLt2gazOV8Iklrx+qv0Z2zqRqDXbbM= Received: by 10.114.124.1 with SMTP id w1mr1568552wac.114.1200526054979; Wed, 16 Jan 2008 15:27:34 -0800 (PST) Received: by 10.114.133.5 with HTTP; Wed, 16 Jan 2008 15:27:34 -0800 (PST) Message-ID: Date: Wed, 16 Jan 2008 17:27:34 -0600 From: "Scott Marlowe" To: "Tom Davies" Subject: Re: Backup of live database Cc: pgsql-admin@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5a9699850801152257g6ee9513i6c4fc88a5f20a785@mail.gmail.com> <478DAC1D.3010909@commandprompt.com> <5a9699850801152310g39fa9bf3y3926892145ab3dcf@mail.gmail.com> <478DBAC3.8050802@commandprompt.com> <5a9699850801160024y7abdcd2fjdb1035c2070797eb@mail.gmail.com> <478E4214.6030805@jobflash.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/195 X-Sequence-Number: 27969 On Jan 16, 2008 4:56 PM, Tom Davies wrote: > > On 17/01/2008, at 4:42 AM, Tom Arthurs wrote: > > The important thing is to start archiving the WAL files *prior* to > > the first OS backup, or you will end up with an unusable data base. > > Why does the recovery need WAL files from before the backup? It's a timeline thing. The database is coherent at time x1. The wal file started at point x0 and moving forward, at some point, matches up. You run the start_archive command which tells pgsql you're starting your backup at point x1. You start the backup. You now have a backup of the pgsql datastore that's a mix of what you had at x1 when you started, and x2 where you stopped. You apply the WAL from x0 forward to, say x3., and it conveniently rewrites the datastore to be coherent. If your WAL was from some point between x1 and x2 you might have some data in the database that the WAL file wouldn't write over, but was incoherent in regards to what you'd get from point x3. So, some pages now are out of date, because your WAL file isn't old enough.