一、常用索引类型
1、单个索引
db.你的表名.createIndex({"你的字段名":1})
db.你的表名.createIndex({"你的字段名":1}),{ unique: true })
2、复合索引
db.你的表名.createIndex({"你的字段名1":1,"你的字段名2":1})
二、性能分析
db.getCollection('你的表名').find({'你的字段名':"过滤的内容"}).explain("executionStats");
微信扫一扫
db.你的表名.createIndex({"你的字段名":1})
db.你的表名.createIndex({"你的字段名":1}),{ unique: true })
db.你的表名.createIndex({"你的字段名1":1,"你的字段名2":1})
db.getCollection('你的表名').find({'你的字段名':"过滤的内容"}).explain("executionStats");
相关推荐