pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris <dmagick@gmail.com>
To: Sue Fitt <sue@inf.ed.ac.uk>
Cc: pgsql-performance@postgresql.org
Subject: Re: setting up foreign keys
Date: Thu, 10 Aug 2006 18:15:00 +1000
Message-ID: <44DAEB04.9050306@gmail.com> (raw)
In-Reply-To: <44DAE8CF.1030107@inf.ed.ac.uk>
References: <44DAE8CF.1030107@inf.ed.ac.uk>

Sue Fitt wrote:
> Hi all,
> 
> This is my first post to the performance list, I hope someone can help me.
> 
> I'm setting up a table with 2 columns, both of which reference a column 
> in another table:
> 
> CREATE TABLE headwords_core_lexemes (
> core_id int REFERENCES headwords_core(core_id),
> lexeme_id int REFERENCES headwords_core(core_id),
> );

One problem here is both of these are referencing the same column ;) I'm 
sure that's a typo.

It sounds like you have something blocking or locking the other table. 
Check pg_locks (I think it is), 13,000 rows shouldn't take *that* long.


Make sure there is an index on headwords_core(core_id) and whatever the 
other column should be.

Foreign keys have to check the other table so without those indexes, it 
will be slow(er).

-- 
Postgresql & php tutorials
http://www.designmagick.com/



view thread (12+ messages)  latest in thread

Message-ID: <44DAEB04.9050306@gmail.com>
Permalink:  ../44DAEB04.9050306@gmail.com/
Also on:    postgresql.org/message-id/44DAEB04.9050306@gmail.com

 · 

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: dmagick@gmail.com, sue@inf.ed.ac.uk
  Subject: Re: setting up foreign keys
  In-Reply-To: <44DAEB04.9050306@gmail.com>

* 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