Re: setting up foreign keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux