Re: FK Constraints, indexes and performance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ow <oneway_111(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: FK Constraints, indexes and performance
Date: 2003-10-06 04:40:03
Message-ID: 19626.1065415203@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

ow <oneway_111(at)yahoo(dot)com> writes:
> It's understood that FK constraints carry some performance hit. However, the
> performance hit I observe is huge.

It looks to me like the 7.3 planner will not choose indexscans for the FK
check queries in this example, because the comparison operators are
misconstrued as shown in this thread:
http://archives.postgresql.org/pgsql-hackers/2003-03/msg00997.php
The equality operator on your domain is taken to be "oideq" which won't
be the same operator associated with the index on the column.

This seems to be fixed in 7.4. In 7.3 I'd counsel not introducing
domains unnecessarily.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Childs 2003-10-06 04:59:46 Re: FK Constraints, indexes and performance
Previous Message ow 2003-10-06 00:29:59 FK Constraints, indexes and performance