Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id C8E741FC9B63 for ; Mon, 13 Feb 2012 11:46:46 -0400 (AST) Received: from [76.14.161.106] (helo=newserver.jfcomputer.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Rwy73-00031d-Kj for pgsql-sql@postgresql.org; Mon, 13 Feb 2012 15:46:46 +0000 Received: from localhost (unknown [127.0.0.1]) by newserver.jfcomputer.com (Postfix) with ESMTP id CA2E412346 for ; Mon, 13 Feb 2012 15:46:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at site Received: from newserver.jfcomputer.com ([127.0.0.1]) by localhost (linux-jfp8.site [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0SNeC-xNmGAF for ; Mon, 13 Feb 2012 07:46:31 -0800 (PST) Received: from linux-12.localnet (unknown [192.168.1.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johnf@jfcomputer.com) by newserver.jfcomputer.com (Postfix) with ESMTPSA id 390575D2A for ; Mon, 13 Feb 2012 07:46:31 -0800 (PST) From: John Fabiani To: pgsql-sql@postgresql.org Subject: foreign key is it a real key Date: Mon, 13 Feb 2012 07:46:31 -0800 Message-ID: <5075215.HTHcEtzjPG@linux-12> User-Agent: KMail/4.7.2 (Linux/3.1.9-1.4-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Host-Lookup-Failed: Reverse DNS lookup failed for 76.14.161.106 (failed) X-Pg-Spam-Score: 1.6 (+) X-Archive-Number: 201202/41 X-Sequence-Number: 36334 Hi, I have read a few articles and I'm not sure if it's me or the authors but I do not believe my question was answered. If I have table that has a PK and a FK - will the planner use the FK just same as it would use the PK? IOW's is a FK also an index used by the planner? I have a lagacy table that contains a FK constraint (vendor_id --> vendor_info). I believe I need an index to improve the performance of a query because I'm using the column as part of my join. Explain does not appear to use it as an index (instead of a seq scan it uses a hash join). But the table all ready has a FK key contraint on the column. Thanks in advance, Johnf