Skip to content

Instantly share code, notes, and snippets.

@Moln
Last active September 15, 2017 01:40
Show Gist options
  • Save Moln/332a5f66746a1506b05abd601e38d7d7 to your computer and use it in GitHub Desktop.
Save Moln/332a5f66746a1506b05abd601e38d7d7 to your computer and use it in GitHub Desktop.
Mysql 处理大数据那些坑

数据 insert 效率只有每秒300

原因: mysql innodb引擎开启了日志事务功能,参数配置:my.cnf 默认 innodb_flush_log_at_trx_commit=1 调整为0;

修改后 insert 大概每秒 5000,

Delete 后的数据表,影响索引?

发现一数据总数据1700万, 由于程序脚本编写BUG导致, 向数据表误导入500+万数据. 经 Delete 语法删除尾部多余的 500+万数据后. 查询数据尾部数据 SELECT * FROM t ORDER BY id DESC LIMIT 10 非常缓慢. 原因未知,选择了清空表重新导入数据.

相关问题: https://stackoverflow.com/questions/2924671/mysql-delete-and-index-hint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment