title: Does making relationships in Database make them slow
body: <p>I have just started internship at a small software house and I am working on an ERP. My team lead has forbidden me to create any relationships in the database. As this is my internship I was shocked because till now I have read that relationships are necessary for ensuring data integrity. My team lead told me that we can enforce the data integrity at the front end. After some research I found out that foreign keys do make the db slower but Indexing foreign keys can increase performance.</p>
  
  <h1>Questions</h1>
  
  <ul>
  <li>How making foreign keys cost performance?</li>
  <li>Does ensuring data integrity at the front end not cost performance ? If yes then what will be difference between the performance cost by database foreign keys and cost by ensuring data integrity rules at the front end? </li>
  <li>If database foreign keys do make the database slower, and integrity rules at the application layer is a better approach then why do our relational databases allowed to have foreign keys at all? </li>
  <li>After doing some research and reading that relationships do make db slower I tried to think of a scenario where ensuring data integrity at application layer is not possible but I could not think of one, If someone can explain this, it would be great.</li>
  <li><p>If indexing foreign keys increase performance then what would be better out of the two below:</p>
  
  <p>1.) Ensuring data integrity rules at application layer</p>
  
  <p>2.) Indexing Foreign Keys</p></li>
  </ul>
  
  <p>Thanks for help.</p>