On 08/05/2007 13:14, Felix Kater wrote:

There is *no complete* substitute for foreign keys by using *indexes*
since I'd loose the referencial integrity (whereas for unique contraints
there *is* a full replacement using indexes)?

Here's my understanding....an index is just that (an index) and no more - it tells PostgreSQL where to look in a table to find a particular row or set of rows. A foreign key, on the other hand, ensures that referential integrity is enforced: it enforces the relationship between rows in a table which refer to rows in another table, depending on how the foreign key was specified in the first place (cf. the "ON UPDATE... ON DELETE... etc. clauses).

When you have a foreign key, you can put an index on the foreign key column in the "child" table for performance reasons, but this *isn't* the same as the foreign key.

I don't know about the equivalence of unique constraints and indices - others on the list can answer that.

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
[EMAIL PROTECTED]
---------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to