Re: Foreign key slows down copy/insert - Mailing list pgsql-performance

From Vivek Khera
Subject Re: Foreign key slows down copy/insert
Date
Msg-id 5cb421b6dd5dca3586616b66390b0d40@khera.org
Whole thread Raw
In response to Foreign key slows down copy/insert  (Richard van den Berg <richard.vandenberg@trust-factory.com>)
List 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


Attachment

pgsql-performance by date:

Previous
From: Vivek Khera
Date:
Subject: Re: Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? and How
Next
From: Vivek Khera
Date:
Subject: Re: What to do with 6 disks?