title: Adding Additional Where Clause in SQL Takes Big Performance Hit
body: <p>I have an SQL Query that runs through multiple views and tables.</p>
  
  <p>The query runs fine, but when I added another condition in the WHERE clause, it started to have tremendous hit on the performance.</p>
  
  <p>The query is structured like...</p>
  
  <pre><code>         SELECT a.*
             FROM vw_myView a
  LEFT OUTER JOIN tbl1 b ON a.ID = b.ID
  LEFT OUTER JOIN vw_OtherView c ON a.ID = c.ID
  LEFT OUTER JOIN tbl2 d ON c.OtherID = d.OtherID
            WHERE a.Column1 = 'VALUE'
              AND a.Column2 LIKE ISNULL(@parameter, a.Column2)
  </code></pre>
  
  <p>From the query above, when I add the other condition in the WHERE clause, my query now takes a lot of time (more than 3 minutes) to execute and return 1000 records.  Removing the added conditional clause and query returns the records in less than 7 secs.</p>
  
  <p>Thanks.
  What should I be checking to see where the performance hit is tremendous </p>