Discuz教程网

mysql 10w级别的mysql数据插入

[复制链接]
authicon dly 发表于 2011-9-11 21:07:07 | 显示全部楼层 |阅读模式
开始没想到,这10w的数据一个号码一个号码的插入半个小时才2w。后来改进一条SQL批量插入
  1. -- 优化代码之前的
  2. insert into table(mobile) values (138000000);
  3. insert into table(mobile) values (138000000);
  4. insert into table(mobile) values (138000000);
  5. ……

  6. -- 优化之后的
  7. insert into table(mobile) values (138000000), (138000000), (138000000);……

  8. -- 优化之后插入12w数据包括php做数据处理,开销才 6s 左右。
复制代码



上一篇:mysql数据库从服务器移植到个人PC的方法
下一篇:mysql一个字段同时满足多个条件的查询
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 22:00

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表