Group By with aggregate Query is timing out MySQL -
when run query on table has 14k records
select max(id) 'id' table_records search_counter='0' group record_date
it executes in 0.016 sec returns 676 records
the id column primary key , having unique index defined on it
now when use above query subquery example
select * table_records id in (select max(id) 'id' table_records search_counter='0' group record_date)
this executes forever. on local dev machine takes 139.511 sec execute on server gets timed out
i not sure what's wrong here.
any appreciated
instead of in
run join query
select t1.id, t1.record_date table_records t1 inner join (select max(id) 'id' table_records search_counter='0' group record_date) t2 on t1.id = t2.id;
Comments
Post a Comment