Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

导出脚本支持批量插入,提高大表的导出速度,默认导出不使用use database 语句,以防止导入时选库其他库时,导入错误的库 #12

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

songdemei
Copy link

1、dump方法增加配置:
mysqldump.WithMultyInsert(1000)
其中1000 为表记录最大一条SQL语句插入1000行数据,默认时一条数据一条insert,导入时,速度较慢。
2、默认去掉use db;语句,如果需要,在dump方法内增加:
mysqldump.WithUseDb()
举例:导出A库的数据,然后我要用工具导入到测试库A1内,原来是实现不了的,现在导入时,工具先选择A1库,再执行脚本即可导入到A1库,

下个版本:
导出增加触发器支持
导出使用多协程,提高导出速度

@jarvanstack
Copy link
Owner

  1. mysqldump.WithMergeInsert() 方法可以合并插入语句,大幅提高导入速度
  2. 默认去掉use db 语句,这是很好的建议
  3. 因为你的 PR 改掉了 mod,会导致库无法使用,你需要 PR 的话就需要修改下

@jarvanstack
Copy link
Owner

  1. 因为现在的程序可以 dump 多个数据库,所以需要 use db, 如果想要去掉的话需要去掉这个支持多个 dump 的功能.

@jarvanstack
Copy link
Owner

优化默认 use db, v0.7.0

增加配置项withLogOut默认不输出日志,如果需要,手动开启
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants