X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 901D6D1B55D for ; Mon, 17 Nov 2003 20:38:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46795-09 for ; Mon, 17 Nov 2003 16:38:27 -0400 (AST) Received: from web21401.mail.yahoo.com (web21401.mail.yahoo.com [216.136.232.71]) by svr1.postgresql.org (Postfix) with SMTP id 4BFF8D1C4D4 for ; Mon, 17 Nov 2003 16:38:25 -0400 (AST) Message-ID: <20031117203824.18689.qmail@web21401.mail.yahoo.com> Received: from [64.81.205.234] by web21401.mail.yahoo.com via HTTP; Mon, 17 Nov 2003 12:38:24 PST Date: Mon, 17 Nov 2003 12:38:24 -0800 (PST) From: ow Subject: Re: pg_restore and FK constraints with large dbs To: Jeff , Stephan Szabo Cc: pgsql-admin@postgresql.org In-Reply-To: <20031117144703.138edb9f.threshar@torgo.978.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/318 X-Sequence-Number: 11305 --- Jeff wrote: > On Mon, 17 Nov 2003 10:40:20 -0800 (PST) > Stephan Szabo wrote: > > > > > By the way, what does your schema look like? I created an 80M row fk > > table and 20K row pk table with an int4 key between them and indexes on > > the two key fields. It took about 25 minutes on my not terribly fast > > system using 7.4b5 to make the foreign key between them. It might have > > been faster if I'd raised sort_mem to something larger than 8192. > > PK and FK keys are of "Dkey" domain, "Dkey" domain is mapped to INT4. There's PK index on 20K pk table, *NO* index on the fk field on 80M fk table. Why no index on the fk field? Several reasons: (1) app logic does not call for accessing fk table based solely on the fk (2) fk field is a part of multi-field AK index (3) unnecessary indexes take space and slow down inserts/updates, which is a factor for large tables. > i missed the start of this thread... but unless you are running 7.4 adding an > FK (restore) is very slow. ZIt is fixed in 7.4.. especially w/lots of sort > mem. Am running 7.4.rc2 and it takes me about 4.5 hours to verify one (1) FK constraint. > But the need still exists for a faster backup & restore. Can't agree more. Thanks __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree