Below is the Update statement that i have to perform on Web_logins table which is having 21 million records.Is there any way to fine tune that query?
Please suggest me..
[code=mysql]
update web_logins w set (last_login_dat e, login_count)=
(select max(date_time), w.login_count + count(date_time ) from temp_login t
where t.acct_nr=w.acc t_nr)
where exists (select 'x' from temp_login t where w.acct_nr=t.acc t_nr)
[/code]
Index is created on acct_nr of web_logins before update statement.
Thanks,
Mani
Please enclose your posted code in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use [code] tags in future.
MODERATOR
Please suggest me..
[code=mysql]
update web_logins w set (last_login_dat e, login_count)=
(select max(date_time), w.login_count + count(date_time ) from temp_login t
where t.acct_nr=w.acc t_nr)
where exists (select 'x' from temp_login t where w.acct_nr=t.acc t_nr)
[/code]
Index is created on acct_nr of web_logins before update statement.
Thanks,
Mani
Please enclose your posted code in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use [code] tags in future.
MODERATOR