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 AFE0A9DCC77 for ; Wed, 22 Mar 2006 08:47:34 -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 34831-10 for ; Wed, 22 Mar 2006 08:47:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 4992D9DCC61 for ; Wed, 22 Mar 2006 08:47:29 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 860F756423; Wed, 22 Mar 2006 06:47:33 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 22 Mar 2006 06:47:32 -0600 Date: Wed, 22 Mar 2006 06:47:32 -0600 From: "Jim C. Nasby" To: Simon Riggs Cc: pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060322124732.GA15742@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1142973230.24487.501.camel@localhost.localdomain> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060322:simon@2ndquadrant.com::vpj6Kh8NM6z/g+qD:0000000000000000 000000000000000000000000Eeqi X-Hashcash: 1:20:060322:pgsql-performance@postgresql.org::zBIx9C3VjbGl7pEJ:00000 0000000000000000000000001Tf8 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.107 required=5 tests=[AWL=0.107] X-Spam-Score: 0.107 X-Spam-Level: X-Archive-Number: 200603/447 X-Sequence-Number: 17884 On Tue, Mar 21, 2006 at 08:33:50PM +0000, Simon Riggs wrote: > On Tue, 2006-03-21 at 06:22 -0600, Jim C. Nasby wrote: > > Currently, it appears that SELECT * INTO new_table FROM old_table logs > > each page as it's written to WAL. Is this actually needed? Couldn't the > > database simply log that the SELECT ... INTO statement was executed > > instead? Doing so would likely result in a large performance improvement > > in most installs. Is there no provision for writing anything but data > > page changes (or whole pages) to WAL? > > AFAIK it takes the same code path as CREATE TABLE AS SELECT, which > already does exactly what you suggest (except when using PITR). Ok, I saw disk activity on the base directory and assumed it was pg_xlog stuff. Turns out that both SELECT INTO and CREATE TABLE AS ignore default_tablepsace and create the new tables in the base directory. I'm guessing that's a bug... (this is on 8.1.2, btw). Also, why do we log rows for CTAS/SELECT INTO when PITR is in use for simple SELECTs (ones that don't call non-deterministic functions)? The data should alread be available AFAICS... -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461