Bug #4623 bad optimization "group by" clause
Submitted: 19 Jul 2004 10:43 Modified: 22 Jul 2004 15:40
Reporter: Alexey Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.0.18 OS:Microsoft Windows (Win 2000 Prof)
Assigned to: CPU Architecture:Any

[19 Jul 2004 10:43] Alexey
Description:
suppose table:
create table ttt( 
  id1 int not null, 
  id2 int not null,
  primary key(id1)
);

select id1 from ttt group by id1 
-- work very slowly
select id1, max(id2) from ttt group by id1
-- really needed query work slowly too
-- if write
select max(id2) from ttt where id1=xxx
-- work fast

How to repeat:
see description
[22 Jul 2004 15:40] Alexander Keremidarski
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

Your GROUP BY query must scan the values of id2 in *all* rows