Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

mongodb中有一个collection,几乎所有字段都要查询或参与排序,请问怎么设计与优化?感谢

如题,有一个collection中,有20个字段,可能有15 6个要参与查询,像时间戳类的还要排序。
请问这种问题需要怎么设计,前期-中期-后期。


题外话,之前有玩网络游戏的交易平台,那种查询和筛选感觉有几十个条件,他们又是如何做的呢?


感谢前辈帮助


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

就一字排开,这种又不会造成什么性能问题。索引是分先后的,规定好索引,然后前段查询的顺序注意一下就好了。

最烦的是需要跨多个表查询,mongo本身又不适合这种。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...