title: how to avoid group by on a lot of columns
body: <p>I have two large tables </p>
  
  <p>-Master table A: 1.4million rows<br>
  -Detail table B: 9 million rows  </p>
  
  <p>B has a foreign key to A.</p>
  
  <p>Basically I need all the 25 detail-fields from table A + in this case a count on B.</p>
  
  <p>Now I have the following pseudo query:</p>
  
  <pre><code>Select
         A.field1,
         A.field2,
         ...
         A.field25,
         Count(b.id)
   from
         A left outer join B on B.fkAid = A.id
   Group by 
         A.id,
         A.field1,
         A.field2,
         ...
         A.field25
  Order by A.field1  
  </code></pre>
  
  <p>The Query plans show the grouping by to take a lot of time (no surprise).</p>
  
  <p>Is there a more efficient way to do this kind of Select? </p>