Joost Kraaijeveld wrote:
> Hi,
>
> I am trying to create a foreign key, followed by creating anindex on the
> foreign key, using PgAdmin III
>
> The command that are generated :
>
> ALTER TABLE prototype.orderlines ADD CONSTRAINT fk_orderlines_orders
> FOREIGN KEY (orderobjectid) REFERENCES prototype.orders (objectid)
> ON UPDATE RESTRICT ON DELETE RESTRICT;
>
> CREATE INDEX fki_orderlines_orders ON
> prototype.orderlines(orderobjectid);
>
> Ont the second command PostgreSQL hangs forever. The
> prototype.orderlines table is completely empty, the prototype.orders
> table contains 1.000.000+ records.
Well, if orderlines is empty it shouldn't take long to create an index.
I'd suspect lock issues - see what's in the pg_locks view.
It's also worth trying these things in psql too - that way you know
exactly what is being executed.
--
Richard Huxton
Archonet Ltd