且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查是否正在使用索引

更新时间:2022-06-25 23:23:53

在Github上有一个很酷的脚本,您应该看一下:

There is a pretty cool script out on Github that you should look at:

https://github.com/wfreeman/indexalizer

基本上,它涉及为数据库打开概要分析,然后它将使用探查器收集的数据来驱动explain()调用.然后,它告诉您哪些索引未使用,哪些查询未使用索引.很漂亮.

Basically it involves turning on profiling for your database and then it will use the data collected by the profiler to drive explain() calls. It then tells you both which indexes are not being used and which queries are not using indexes. Pretty slick.

有关mongoDB数据库分析的更多信息:

More about mongoDB database profiling:

http://docs.mongodb.org/manual/reference/database-profiler/