The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed.
LOAD DATA LOCAL INFILE '/tmp/merchant.log'
REPLACE INTO TABLE `log`
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(date,merchant,landing_page,source_keyword,type,inclicking,revenue,order_count,sales,site,update_time)
/tmp/merchant.log 内容如下:
2017-10-29,dailydeals.html,/dailydeals.html,google_keyword,sem,2,0.00,0,0,uk,2018-02-28 15:40:48
2017-10-29,free-delivery-codes/,/free-delivery-codes/,google_keyword,sem,28,8.94,2,156.6062,uk,2018-02-28 15:40:48