- 论坛徽章:
- 0
|
我想把一张2000万记录的MyISAM表导入到Innodb,
innodb_data_home_dir = /var/lib/mysql/
innodb_data_file_path = ibdata1:1G;ibdata2:1G:autoextend
innodb_log_group_home_dir = /var/lib/mysql/
innodb_buffer_pool_size = 3G
innodb_additional_mem_pool_size = 64M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 0
#innodb_lock_wait_timeout = 50
innodb_flush_method = O_DIRECT
innodb_max_dirty_pages_pct = 70
我的机器是linux 64位,free -k结果如下
total used free shared buffers cached
Mem: 4951544 4495508 456036 0 120864 581772
-/+ buffers/cache: 3792872 1158672
Swap: 7045112 0 7045112
我用这样的方法导入:
SELECT * FROM myisam_table INTO OUTFILE 'exportdb.txt';
CREATE TABLE innodb_table LIKE myisam_table;
ALTER TABLE innodb_table ENGINE=InnoDB;
SET AUTOCOMMIT=0; #关闭事务自动提交
SET UNIQUE_CHECKS=0; #关闭唯一性校验
LOAD DATA INFILE 'exportdb.txt' INTO TABLE innodb_table;
COMMIT;
SET UNIQUE_CHECKS=1
开始导入速度很快大概每秒1100多条,但是等到插入上百万条后下降到每秒不到100条,最后只有每秒40,50条左右了,
请问我的配置有没有问题?是不是我的机器内存不能胜任2000万条的记录?不知道大家有没有更好的办法 |
|