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

mongodb小想法 #8

Open
vicanso opened this issue May 15, 2019 · 0 comments
Open

mongodb小想法 #8

vicanso opened this issue May 15, 2019 · 0 comments

Comments

@vicanso
Copy link
Owner

vicanso commented May 15, 2019

今天有朋友说他们项目有开发写的查询有问题,导致线上mongodb全表扫描,拖慢了整个数据库,该怎么避免好?我有一个小想法,因为功能肯定在测试环境有验收,只是测试环境数据量比不上线上环境,因此问题没有发现,那么如果我转换为只关注查询时是不是对整表或者大比例的节点扫描。方案如下:

  • 测试环境开启所有日志记录
  • 定时从db.system.profile取记录,查看每个请求对应的扫描文档数与其对应的表的总数(如果超时20%则该请求有问题的概率较大)
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

1 participant