Re: Foreign key slows down copy/insert

From: Vivek Khera <vivek(at)khera(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Foreign key slows down copy/insert
Date: 2005-04-20 15:27:22
Message-ID: 5cb421b6dd5dca3586616b66390b0d40@khera.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


On Apr 14, 2005, at 7:59 AM, Richard van den Berg wrote:

> How do I explain why test cases 2 and 3 do not come close to case 1?
> Am I missing something obvious?

there's cost involved with enforcing the FK: if you're indexes can't be
used then you're doing a boatload of sequence scans to find and lock
the referenced rows in the parent tables.

Make sure you have indexes on your FK columns (on *both* tables), and
that the data type on both tables is the same.

Vivek Khera, Ph.D.
+1-301-869-4449 x806

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Vivek Khera 2005-04-20 15:36:29 Re: What to do with 6 disks?
Previous Message Vivek Khera 2005-04-20 15:24:56 Re: Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? and How