Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 3
    sure, it can use those indexes to optimize...but that doesn't automatically mean there is no negative impact on performance. I think too many factors are involved to put this question to sleep with this reference. Commented Feb 23, 2010 at 10:56
  • @Roland: I see your point, and I agree with you. However my intention was to address the "I'm trying my best to persuade my boss" part of the question. Commented Feb 23, 2010 at 10:58
  • 1
    @Roland: In addition, the performance hit is very rarely severe. As you said in your answer, this is difficult to claim without knowledge of the application, but in practice the benefits of foreign keys are rarely traded for performance. Related SO post: stackoverflow.com/questions/1744878/… Commented Feb 23, 2010 at 11:16
  • Good link, I'll send him that with the quote as well :-) Commented Feb 23, 2010 at 11:48
  • 1
    What that statement means is that, for example, the optimizer will know that a column defined as the only member of a primary key is both not-null and uniquely defined. Similarly, a single-column foreign key's number of distinct values is constrained by the cardinality of the table on which it depends (plus possibly null). Commented Feb 24, 2010 at 20:37