Re:SQL is 43 years old – Here’s why we still use it today
by jrochkind1 on Tuesday May 02, 2017 @09:50AM
(#14246270)
I think in general most rdbms require indexes to properly enforce foreign key constraints in a reasonable way.
[ Parent
| on HN ]
Re:SQL is 43 years old – Here’s why we still use it today
by dspillett on Tuesday May 02, 2017 @10:20AM
(#14246529)
If the parent entities are immutable, or are at least immortal and have primary key values that are immutable, then the DB engine will only need the index on the target primary/unique key/index to maintain the constraint.
Though in general this is not the case, as you say, it is the case often enough that enforcing "FK means an index" could be an annoyance.