Mongodb数据库索引、explain使用

Jiafeng

分类: mongodb 336 0

Mongodb索引及explain使用 作用:在数据库查询数据速度更快

获取当前集合的索引

db.collections.getIndexes()

为当前集合对象创建索引的命令

db.collections.ensureIndex({name:1})

删除当前集合对象索引的命令

db.collections.dropIndex({name:1})

使用explain executionStats查询具体的 查询时间

db.collections.find().explain("executionStats")
  • 0人 Love
  • 0人 Haha
  • 0人 Wow
  • 0人 Sad
  • 0人 Angry
mongodb

作者简介: Jiafeng

共 0 条评论关于 “Mongodb数据库索引、explain使用”

Loading...