performance - How to tune this query when updating 4 million records in MySQL? -


i have query set date far far in future. table has 4 million records. , query straight forward. query took 3 min run.

update table  set to_date = str_to_date('31-01-3000','%d-%m-%y')  to_date null; 

there's no index on column.

how can tune query or mysql itself? lot.

fastest solution not involving index (and in fact, fastest solution period), make column default '31-01-3000', means you'll never have update it. note initial alter may take quite few minutes, though, considering you're running on such large table.

alter table `table_name` change column `to_date` `to_date` date not null default '3000-01-31'; 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -