First, I suggest to you validate the time of the query "saving" it into a temporary table (include the into temp tmp01 with no log
) , which you answer at the comments the time don't change.
Considering the large fields mentioned (char(256)) as description of something , my suggestion is :
- At group by use only key columns. Use they id/codes if possible.
- Execute the SQL with "group by" saving into a temporary table.
- Execute other SQL over this temporary table and join to get the descriptions. (char(256) fields)
please, accept the answer if they really work for you... if is useful but not solve your problem only set +1 for it