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

为什么在进行save保存时使用时间很长如何优化? #14

Open
pshaoyi opened this issue Jan 17, 2019 · 1 comment
Open

为什么在进行save保存时使用时间很长如何优化? #14

pshaoyi opened this issue Jan 17, 2019 · 1 comment

Comments

@pshaoyi
Copy link

pshaoyi commented Jan 17, 2019

BuguDao 的save()方法暂用时间很长,我在进行循环插入的时候100多条数据能占用将近2分钟的时间。

@xbwen
Copy link
Owner

xbwen commented Jan 18, 2019

这就要具体问题具体分析了。
可能的情况如下:
1、硬件环境问题(包括机器性能、网络环境等等)。
2、如果使用自增长的ID,需要查询数据库获取到目前最大的ID值,会比较慢。一般情况下不推荐使用自增长ID。
3、还跟WriteConcern参数的设置有关系,比如WriteConcern如果设置成了MAJORITY的话,就相对较慢。

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

No branches or pull requests

2 participants