2021年1月12日 星期二

MySQL 大量資料 insert 加速方式

 這裏


Bulk inserts of data(區塊式 insert)

  • Extended inserts
     一次 insert 多筆

  • Transactions
      把 insert 放到 transaction 裡

Avoid indexes

先 drop index, 等 insert 完成再加回去

Skipping the binary log

暫時關閉 binary log
set sql_log_bin=0;

Multiple connections


Truncate table with foreign keys


Index is used for sort 

搜尋覆蓋

沒有留言:

張貼留言