[SQL] Links between rows in a table

2005-03-05 Thread Stefan Weiss
Hi. We are currently designing a web-based application in which users can add other users as "friends". These links are bi-directional, meaning that when A adds B to his friends, he is automatically one of B's friends. Eventually we will have to add a feature that shows how A is is related to some

Re: [SQL] Postgres performance

2005-03-05 Thread PFC
No, I haven't foreign keys in the older version, in that new I've it... however I manage relations from app code (PHP)... Really ? In my experience this is a sure way to get inconsistencies slowly creeping into your database, and you also get a load of funky concurrency issues. doesn't MYSQ

Re: [SQL] Postgresql FK to MS SQL triggers

2005-03-05 Thread Josh Berkus
Igor, > For interested people I wrote a PHP script which: > 1) Extracts all underlying triggers from pg_trigger table in Postgres used > to support FK (3 triggers for each FK) > 2) Generates a MSSQL script file which recreates all triggers in MSSQL How about a script which goes the other way? -

Re: [SQL] Simple delete takes hours

2005-03-05 Thread Thomas Mueller
On 05.03.2005 00:24 PFC wrote: > Every time a row is removed from pwd_name, the ON DELETE CASCADE > trigger will look in pwd_name_rev if there is a row to delete... Does > it have an index on pwd_name_rev( rev_of ) ? If not you'll get a full > table scan for every row deleted in pwd_name...