title: Error "1038 Out of sort memory, consider increasing sort buffer size
body: <p>In symfony2, doctrine2, I have a query which triggers an error :</p>
  
  <pre><code>Error "1038 Out of sort memory, consider increasing server sort buffer size
  </code></pre>
  
  <p>The query :</p>
  
  <pre><code>$queryBuilder = $this
      -&gt;createQueryBuilder('object')
      -&gt;leftJoin('object.objectCategory', 'c')
      -&gt;leftJoin('object.medias', 'm')
      -&gt;leftJoin('object.recipients', 'r')
      -&gt;leftJoin('object.answers', 'a')
      -&gt;leftJoin('object.tags', 't')
      -&gt;leftJoin('object.user', 'u')
      -&gt;leftJoin('object.votes', 'v')
      -&gt;leftJoin('object.comments', 'comments')
      -&gt;leftJoin('v.user', 'vuser')
      -&gt;addSelect('c, t, v, u')
      -&gt;groupBy('object, c, t, v, u')
      -&gt;where('object.isVisible = :isVisible')
      -&gt;orderBy('object.createdAt', 'DESC')
      -&gt;setParameter('isVisible', true)
      -&gt;addSelect('SUM(v.value) AS HIDDEN vote_value')
      -&gt;orderBy('vote_value', 'DESC')
      ;
  </code></pre>
  
  <p>If I omit the group by, it runs just fine.
  If I add select and group by less elements, it runs fine also but then I have more subqueries launched in my twig templates.</p>
  
  <p>How can I either optimize this query to not have the error OR get rid of the error by allocating more memory (ideally just for this query) ?</p>