千万数据快速模拟插入

python -c "for i in range(1, 1+1000000): print(i)" > base.txt

mysql> use test;
ERROR 1049 (42000): Unknown database 'test'
mysql> use test01;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+------------------+
| Tables_in_test01 |
+------------------+
| t1 |
| tmp_table |
| ytt_pt1 |
+------------------+
3 rows in set (0.00 sec)

mysql> load data infile '/opt/base.txt' replace into table tmp_table;
Query OK, 1000000 rows affected (15.05 sec)
Records: 1000000 Deleted: 0 Skipped: 0 Warnings: 0

mysql>

https://zhuanlan.zhihu.com/p/74788180

黑洞@heidsoft
Github:https://github.com/heidsoft
微博:http://weibo.com/liuganbin
热衷云计算和大数据
关注CloudStack,OpenStack,Linux c/c++/python/java
关注研究新技术
原文地址:https://www.cnblogs.com/heidsoft/p/15769337.html