| From: | "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
| Cc: | pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: How do FKs work? | 
| Date: | 2004-10-10 00:43:50 | 
| Message-ID: | 20041009214318.V54093@ganymede.hub.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
On Sat, 9 Oct 2004, Tom Lane wrote:
> "Marc G. Fournier" <scrappy(at)hub(dot)org> writes:
>> Have a table with two FKs on it ... 2 different fields in the table point
>> to the same field in another table ...
>
>> When I do an 'EXPLAIN ANALYZE DELETE FROM table WHERE field = #;', it
>> never comes back ... or, at lesat, takes a *very* long time ...
>
> Do you have indexes on the referencing columns?  Are they exactly the
> same datatype as the referenced column?  You can get really awful plans
> for the FK-checking queries if not.
Yup, that was my first thought ... running SELECT's joining the two tables 
on the FK fields shows indices being used, and fast times ...
----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy(at)hub(dot)org           Yahoo!: yscrappy              ICQ: 7615664
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Marc G. Fournier | 2004-10-10 00:48:43 | Re: How do FKs work? | 
| Previous Message | Tom Lane | 2004-10-10 00:23:53 | Re: How do FKs work? |