Home > Database > Mysql Tutorial > mysql高效导数据的方法讲解_MySQL

mysql高效导数据的方法讲解_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:25:36
Original
920 people have browsed it

bitsCN.com 数据:一个db,2000个表格,2000张表格数据,每条记录30个column,平均每张表格4.3w条记录,总共86388670条记录。

机器:linux 64bit 8G内存 4核IntelX3320@2.5GHz

基本思路:

mysql -utest -pxxxx -s -e "source xxxx.sql"


将load语句放在xxxx.sql中

load语法:

load data  [low_priority] [local] infile 'file_name.txt' [replace | ignore]

如果串行导入数据,会很慢,考虑并行,但可能有冲突,解决办法:

load之前清空表  

truncate table xxxx 或 delete from table xxxx;

或使用replace或ignore关键字。bitsCN.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template