Order by on aggregate always does a sort even if the sort is not needed. ------------------------------------------------------------------------
Key: DERBY-3276 URL: https://issues.apache.org/jira/browse/DERBY-3276 Project: Derby Issue Type: Improvement Components: SQL Reporter: Manish Khettry See DERBY-3231 for details. A few different variations of queries that do not need a sort are: select b, max(a) from yy where a=5 group by b order by max(a) asc; select b, max(a) from yy where a=5 group by b order by max(a) desc; Also consider select a, sum(b) from yy group by a having sum(b) = 2 order by sum(b); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.