In the last episode (Mar 05), Daevid Vincent said:
> http://www.mysql.com/doc/en/SEC457.html states that "there must be an
> index where the foreign key and the referenced key are listed as the
> FIRST columns." Will this restriction be lifted soon? It is
> incredibly frustrating. I don't see why they have to be indexes, and
> more importantly, I don't see why they have to be FIRST! Ugh.

I'm not sure that sentence means what you think it does.  What they're
saying is you need to index both fields, and if you decide to make that
index a compound one with multiple keyparts, the foreign/referenced
field must be the first.  They don't have to be the first fields in the
table or anything.

As for why you want them indexed.  Have you ever tried deleting a lot
of records from a table with a foreign key constraint on another table
with no index?  Each delete of your first table requires a full table
scan of the second table, to make sure you're not violating the
constraint.  A co-worker forgot to index a constraint in Oracle once
and his table updates took 2 hours instead of 2 minutes.

-- 
        Dan Nelson
        [EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to