pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vivek Khera <vivek@khera.org>
To: pgsql-performance@postgresql.org
Subject: Re: Foreign key slows down copy/insert
Date: Wed, 20 Apr 2005 11:27:22 -0400
Message-ID: <5cb421b6dd5dca3586616b66390b0d40@khera.org> (raw)
In-Reply-To: <425E5B38.6020407@trust-factory.com>
References: <425E5B38.6020407@trust-factory.com>


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

Attachments:

  smime.p7s (application/pkcs7-signature, 2.4K) download

view thread (24+ messages)

Message-ID: <5cb421b6dd5dca3586616b66390b0d40@khera.org>
Permalink:  ../5cb421b6dd5dca3586616b66390b0d40@khera.org/
Also on:    postgresql.org/message-id/5cb421b6dd5dca3586616b66390b0d40@khera.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: vivek@khera.org
  Subject: Re: Foreign key slows down copy/insert
  In-Reply-To: <5cb421b6dd5dca3586616b66390b0d40@khera.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox