X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id E54959FB261 for ; Sun, 13 Aug 2006 23:14:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 83081-07 for ; Mon, 14 Aug 2006 02:14:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.181]) by postgresql.org (Postfix) with ESMTP id C6B319FB20E for ; Sun, 13 Aug 2006 23:14:12 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so357090pyd for ; Sun, 13 Aug 2006 19:14:11 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=lEZWEFISTQwohO5VfucZSi8mQszEWd7wJ9JtBvd+z6jM6O7MWKBB1YBzayqiT5uvDnZDtelu7HnaPkCb72+6OaI/qA2ZwnrT6lWrTUI8GFelSAkWNZGhDRU0DsYO303ZLQA0BngMKM9fUUgQtHiYYS+hb/1xgm/rDDQ6kFcwMlg= Received: by 10.35.41.14 with SMTP id t14mr12146141pyj; Sun, 13 Aug 2006 19:14:11 -0700 (PDT) Received: from ?10.1.1.22? ( [203.217.18.65]) by mx.gmail.com with ESMTP id 5sm379471nzk.2006.08.13.19.14.09; Sun, 13 Aug 2006 19:14:11 -0700 (PDT) Message-ID: <44DFDC73.8000701@gmail.com> Date: Mon, 14 Aug 2006 12:14:11 +1000 From: Chris User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: "Spiegelberg, Greg" CC: pgsql-performance@postgresql.org Subject: Re: setting up foreign keys References: <82E74D266CB9B44390D3CCE44A781ED901368432@POSTOFFICE.cranel.local> In-Reply-To: <82E74D266CB9B44390D3CCE44A781ED901368432@POSTOFFICE.cranel.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.199 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/209 X-Sequence-Number: 20394 Spiegelberg, Greg wrote: > Sort of on topic, how many foreign keys in a single table is good v. > bad? I realize it's relative to the tables the FK's reference so here's > an example: > > Table A: 300 rows > Table B: 15,000,000 rows > Table C: 100,000 rows > Table E: 38 rows > Table F: 9 rows > Table G: is partitioned on the FK from Table A and has a FK column for > each of the above tables > > I'm in the process of normalizing the database and have a schema like > this in mind. Works wonderfully for SELECT's but haven't gotten the > data import process down just yet so I haven't had a chance to put it > through it's paces. Depending on the performance of INSERT, UPDATE, and > COPY I may drop the FK constraints since my app could enforce the FK > checks. As long as both sides of the FK's are indexed I don't think you'll have a problem with a particular number of FK's per table. -- Postgresql & php tutorials http://www.designmagick.com/