DBAtlas · 数据库运维图谱

创建索引(非阻塞)

MongoDB维护

命令

db.customer.createIndex({ email: 1 }, { name: "idx_email" })

作用

在指定字段上创建索引;自 MongoDB 4.2 起,索引构建默认不阻塞写入。

适用场景

为提升查询性能添加新索引时。

注意

在大集合上,索引构建会消耗 CPU 和 IO;primary 上的负载可能增加。

在 DBAtlas 中打开 →

相关内容