MySQL Forums
Forum List  »  InnoDB

Re: MySQL 8 is not using INDEX when subquery has a group column
Posted by: Peter Brawley
Date: November 26, 2019 11:47AM

In the query ...

explain 
update accounts a 
join (
  select uid, sum(balance) balance, day(current_date()) day 
  from users
) r on r.uid=a.uid and r.day=a.day 
set a.balance=r.balance;

... the subquery is missing a Group By clause. Once that's supplied, Explain shows index use.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: MySQL 8 is not using INDEX when subquery has a group column
16
November 26, 2019 11:47AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.