Re: setting up foreign keys

From: Chris <dmagick(at)gmail(dot)com>
To: Sue Fitt <sue(at)inf(dot)ed(dot)ac(dot)uk>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: setting up foreign keys
Date: 2006-08-10 08:15:00
Message-ID: 44DAEB04.9050306@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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/

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Sue Fitt 2006-08-10 09:04:55 Re: setting up foreign keys
Previous Message Sue Fitt 2006-08-10 08:05:35 setting up foreign keys