X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6CC179DCB8B for ; Wed, 22 Mar 2006 11:06:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70379-05 for ; Wed, 22 Mar 2006 11:06:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 07CBF9DC83C for ; Wed, 22 Mar 2006 11:06:06 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k2MF66EA016481; Wed, 22 Mar 2006 10:06:06 -0500 (EST) To: "Jim C. Nasby" cc: Simon Riggs , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command In-reply-to: <20060322131910.GC15742@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@pervasive.com> <1143032914.24487.632.camel@localhost.localdomain> <20060322131910.GC15742@pervasive.com> Comments: In-reply-to "Jim C. Nasby" message dated "Wed, 22 Mar 2006 07:19:10 -0600" Date: Wed, 22 Mar 2006 10:06:05 -0500 Message-ID: <16480.1143039965@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/454 X-Sequence-Number: 17891 "Jim C. Nasby" writes: >> PITR wants all changes. Without PITR we can optimise certain logging >> actions. > The only change here is that we're creating a new table based on the > results of a SELECT. If that SELECT doesn't use anything that's > non-deterministic, then the machine doing the recovery should already > have all the data it needs, provided that we log the SELECT that was > used in the CTAS. This is based on a fundamental misconception about the way PITR log-shipping works. We log actions at the physical level (put this tuple here), not the logical here's-the-statement-we-executed level. The two approaches cannot mix, because as soon as there's any physical discrepancy at all, physical-level actions would be incorrectly applied to the slave database. regards, tom lane