title: Measuring the Performance of SQL Queries
body: <p>Let me say ahead of time, that I have very little understanding of the algorithms that SQL queries go through, so please excuse my ignorance.</p>
  
  <p>My question is: How do you go about evaluating the performance of a particular SQL query? And what metrics are considered?</p>
  
  <p>For example,</p>
  
  <pre><code>SELECT * FROM MyTable;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SELECT * FROM MyTable UNION SELECT * From MyTable;
  </code></pre>
  
  <p>I'm guessing the second one is a lot slower even though both queries return the same results.  But, how could someone evaluate the two and decide which one is better and why?</p>
  
  <p>Are there tools to do this? Is there any type of SQL stack trace?  Etc...</p>
  
  <p>Thanks.</p>