Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 073592E0038 for ; Thu, 5 Jun 2008 04:42:44 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 37052-03 for ; Thu, 5 Jun 2008 04:42:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail136055.authsmtp.co.uk (outmail136055.authsmtp.co.uk [62.13.136.55]) by developer.postgresql.org (Postfix) with ESMTP id AE7872E0035 for ; Thu, 5 Jun 2008 04:42:39 -0300 (ADT) Received: from mail.authsmtp.com (mail.authsmtp.com [62.13.128.187]) by punt2.authsmtp.com (8.14.2/8.13.8/Kp) with ESMTP id m557gZ8b064451; Thu, 5 Jun 2008 08:42:35 +0100 (BST) Received: from [192.168.0.3] (85-211-65-92.dyn.gotadsl.co.uk [85.211.65.92]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m557gSEf009007; Thu, 5 Jun 2008 08:42:29 +0100 (BST) Subject: Re: pg_dump restore time and Foreign Keys From: Simon Riggs To: Heikki Linnakangas Cc: pgsql-hackers In-Reply-To: <48479381.6020006@enterprisedb.com> References: <1212647003.19964.19.camel@ebony.site> <48479381.6020006@enterprisedb.com> Content-Type: text/plain Date: Thu, 05 Jun 2008 08:45:38 +0100 Message-Id: <1212651938.19964.34.camel@ebony.site> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: f31d35ad-32d2-11dd-8155-001185d377ca X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFaABbZ0xf HGQLW1xEUFV7XWF/ aQMfZQBDYEtPQQNv TkFLXVBXFgB3AVJc AxsZBXoHIQVGcX5w YghjWHdeEhJ5dBJ+ Rx8ACG4EMWV9aWFL BF1QdgZRbQNKfx5N bwR8U3ReMCtlM3Bw LC8aFBMcBw5qYDxa dQ0QKEpaW0sQAjkm SlgeHDAiVUQDS20d KAYrK1EaVGUcI15a X-Authentic-SMTP: 61633235383639.squirrel.dmpriest.net.uk:1045/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/222 X-Sequence-Number: 119335 On Thu, 2008-06-05 at 10:19 +0300, Heikki Linnakangas wrote: > Simon Riggs wrote: > > I'm guessing that the WITHOUT CHECK option would not be acceptable as an > > unprotected trap for our lazy and wicked users. :-) > > Yes, that sounds scary. > > Instead, I'd suggest finding ways to speed up the ALTER TABLE ADD > FOREIGN KEY. I managed a suggestion for improving it for integers only, but if anybody has any other ideas, I'm all ears. > Or speeding up COPY into a table with foreign keys already > defined. For example, you might want to build an in-memory hash table of > the keys in the target table, instead of issuing a query on each INSERT, > if the target table isn't huge. No, that's not the problem, but I agree that is a problem also. > Nothing beats the speed of simply not checking the constraint, of > course, but I'd hate to lose the protection it gives. Are you saying you don't like the rest of the proposal, or just don't like the idea of having that added as an unprotected option, but find the proposal acceptable? -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support