title: Do MAX() improves performance of a query?
body: <p>In this post:<a href="https://stackoverflow.com/questions/17806193/sql-query-to-get-the-data/17806247">SQL Query to get the data</a>.</p>
  
  <p>the first answer is:</p>
  
  <pre><code>SELECT students.student_id,student_name,father_name,mother_name,
             COUNT(student_addresses.student_id) AS total_addresses,    
             COUNT(student_phones.student_id) AS total_phones
       FROM students,student_phones,student_addresses
       WHERE students.student_id = student_phones.student_id AND
             students.student_id = student_addresses.student_id AND
             students.student_id = 7
      GROUP BY BY students.student_id,student_name,father_name,mother_name;
  </code></pre>
  
  <p>while the 2nd is:</p>
  
  <pre><code>SELECT s.student_id,
         max(s.student_name) student_name,
         max(s.father_name) father_name,
         max(s.mother_name) mother_name,
         COUNT(distinct a.student_address_id) total_addresses,    
         COUNT(distinct p.student_phone_id) total_phones
  FROM students s
  LEFT JOIN student_phones p ON s.student_id = p.student_id
  LEFT JOIN student_addresses a ON s.student_id = a.student_id
  WHERE s.student_id = 7
  GROUP BY s.student_id
  </code></pre>
  
  <p>Now, the question: are there any significant differences between the two query when it comes to performance? Does the use of <code>MAX()</code> affects the execution time for the 2nd query?</p>
  
  <p>I try to google for answer but no luck. I want a clear and specific explanation for this one.</p>