我需要更新一個表中包含幾百萬行的兩列。做這件事最有效的方法是什麼?一個表中有幾百萬行的更新列
這將是這樣的:
update my_table set column_one = to_date('11/11/11', 'RR/MM/DD'),
column_two = to_date('11/11/11', 'RR/MM/DD');
或本:
update my_table set column_one = to_date('11/11/11', 'RR/MM/DD');
update my_table set column_two = to_date('11/11/11', 'RR/MM/DD');
或者有更好的辦法?
第一個肯定 –
同時更新兩列。但我認爲將它分成幾個更新是個好主意。 (每次更新1000行可能?) – jarlh
閱讀:http://mysqlserverteam.com/multi-table-trick/ –