In some cases, ordering/changing the group by will make alot difference in terms of performance; DB like DB2, Redbrick, Sybase are good examples for this.
we had a requirement in DB2, where Db2 asked us to change the group by order to make the SQL works better.
Solution:
- In the project configuration (project level) –> Report Definition –> SQL Generation –> attribute weights –> <add the attributes in order the way you like to force it in the select clause so that group by will change automatically>
- By combining “Attribute Weights” and the “Max Columns in Index” settings, a user can designate any attribute to be included in the index.