Re: Foreign key constraints compile faster in 7.4

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ashish(at)openskysoftware(dot)com
Cc: pgsql-perform <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Foreign key constraints compile faster in 7.4
Date: 2005-05-03 15:59:47
Message-ID: 19631.1115135987@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Ashish Arte <ashish(at)openskysoftware(dot)com> writes:
> We recently upgraded to Postgres 7.4 from 7.3.9 and noticed that the
> foreign key constraints compile noticeably faster. In 7.3 the
> constraints would typically take more than an hour to run on our
> production data. Now they take a minute or two.

> Can anybody explain such a major performance improvement ?

Hey, we do do some work on this thing from time to time ;-)

Probably you are talking about this:

2003-10-06 12:38 tgl

* src/: backend/commands/tablecmds.c,
backend/utils/adt/ri_triggers.c, include/commands/trigger.h: During
ALTER TABLE ADD FOREIGN KEY, try to check the existing rows using a
single LEFT JOIN query instead of firing the check trigger for each
row individually. Stephan Szabo, with some kibitzing from Tom Lane
and Jan Wieck.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Held 2005-05-03 16:34:05 Re: [HACKERS] Decision Process WAS: Increased company involvement
Previous Message Ashish Arte 2005-05-03 15:11:23 Foreign key constraints compile faster in 7.4

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-05-03 16:12:21 Re:
Previous Message Kris Jurka 2005-05-03 15:57:21 Re: batch inserts are "slow"