Skip site navigation (1) Skip section navigation (2)

foreign key is it a real key

From: John Fabiani <johnf(at)jfcomputer(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: foreign key is it a real key
Date: 2012-02-13 15:46:31
Message-ID: 5075215.HTHcEtzjPG@linux-12 (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
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,



pgsql-sql by date

Next:From: Andreas KretschmerDate: 2012-02-13 15:50:47
Subject: Re: foreign key is it a real key
Previous:From: Philip CoulingDate: 2012-02-12 13:02:20
Subject: Re: Calling Postgresql Function to delete user data

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group