在my中replica set mongodb cluster
,read
可能会发生查询:
- either on column1
- or on column2
- or on combination of column1 and column2
- or on combination of column1 and column3
- or on combination of column2 and column3
- or on combination of column1 and column2 and column3
为上面的每种情况创建6个索引是否有意义,或者有一种有效的方法将这些索引合并到较少的索引数量下?
索引{column1: 1, column2: 1, column 3:1 }
可以在以下服务查询:
索引{column2: 1, column3: 1}
可以在以下服务查询:
{column3: 1, column1: 1}
可以为以下查询服务的索引:
您记录的所有查询都可以使用3个复合索引正确处理。
如果确实需要创建大量索引,请注意mongod每个集合最多可以有64个索引。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句