如果可以,多个查询时可以创建个混合索引.当然这个不是总是可以的,除非你多个查询时使用类似的参数.
试想,你的应用程序运行将进行这些查询:
正如你看到的,y在每个查询中都会出现,所以这个个非常好的索引候选者,z出现在第一次和第二次,w出现在第二次和第三次,所以任何其中的一个都可以作为索引的候选者.
我们要尽可能多的频繁的命中索引.如果上面的某个查询比其它的更重要或者说使用频率更高,我们索引应该尽量偏袒于它.比如说,试想第一个查询运行查过其它两个1000多次.我们应该这么建立索引:
这个查询将会尽可能的最大优化,其它两个查询将会使用部分索引进行查询.
如果三个查询运行次数相近,一个好的混合索引应该是
这样三个查询就会使用y作为标准索引,第二个和第三个能够使用w作为索引,中间那个查询将会全部命中索引.
你可以调用explain()来查看索引怎么在查询中使用的
(译者续: 有关Compound index可以参看官网 http://www.mongodb.org/display/DOCS/Indexes#Indexes-CompoundKeysIndexes )
原版书<<50
Tips and Tricks for MongoDB Developers>>
地址:http://oreilly.com/catalog/0636920019893
皮皮书屋下载地址:http://www.ppurl.com/2011/05/50-tips-and-tricks-for-mongodb-developers.html
本书的所有翻译地址:http://blog.csdn.net/crazyjixiang/article/category/858638
翻译目的:MongoDB资料国内很少,书就更不必说了,借助对MongoDB的理解为大家做点贡献,如果有翻译有误的地方请指正,不能误入子弟,谢谢!
译者:Crazybaby
分享到:
相关推荐
HOMER (Hybrid Optimization of Multiple Electric Renewables), the micropower optimization model, simplifies the task of evaluating designs of both off-grid and grid-connected power systems for a ...
Differential Evolution A Practical Approach to Global Optimization 差分进化算法
If you're an experienced developer looking to solve problems related to objects, functions, inheritance, and other language-specific categories, the abstractions and code templates in this guide are ...
3 Orthogonal Weight Normalization-Solution to Optimization over Multiple Dependent Stiefel Manifolds in Deep Neural Networks-2017.pdf
mysql5.6官方文档:8.3 Optimization and Indexes
Accelerating MATLAB Performance - 1001 Tips to Speed Up MATLAB Programs MATLAB 程序加速技巧 http://undocumentedmatlab.com/books/matlab-performance Accelerating MATLAB Performance: 1001 Tips to ...
线性优化讲义 introduction to linear optimization ,
As you advance to Ruby performance expert, you’ll learn how profile your code, how to make sense out of profiler reports, and how to make optimization decisions based on them. You’ll make sure slow ...
an-introduction-to-optimization-4th-edition-solution-manual 为an introduction-to-optimization-4th-edition 的习题解答,高清英文完整版本
最优化理论的经典书籍。
Differential Evolution——A Practical Approach to Global Optimization 差分进化算法入门基础书籍
本论文首次提出了SMO算法,用于优化二次规划问题,显著提高了SVM算法速度和准确性,为机器学习的发展做出了巨大贡献。
Chapter 25: Query Optimization and Execution Chapter 26: Plan Caching Part V: Practical Troubleshooting Chapter 27: Extended Events Chapter 28: System Troubleshooting Chapter 29: Query Store Part VI...
It solves following optimization problem : min_X || Y-X||_1 + lambda ||Dh*X||_1 + lamdba ||Dv*X||_1 + mu ||X||_* X: Hyperspectral image Y: Compressive measurements Dh, Dv: Horizontal and vertical ...
How to integrate that software with Android Studio, fast becoming the most popular IDE for Android apps design and development Audience Primary audience includes Android developers, especially game ...
Speed up the execution of important database queries by making good choices about which indexes to create. Choose correct index types for different scenarios. Avoid indexing pitfalls that can actually...
本资源 为台湾清华大学祁忠勇教授在大陆教授的凸优化课程,已经去过好多高校了,暑期专业选修课程,需要较为扎实的数学基础,如线性代数,微积分,矩阵论,复变函数等等
Introduction to Linear Optimization, 1997. by Bertsimas and Tsitsiklis
The book sequence is easy to follow and all topics are fully illustrated showing you how to make good use of different performance diagnostic tools. Who this book is written for If you are an ...
and that want to use it to develop high quality application software or software libraries. Almost all the optimization techniques presented are platform independent, and therefore there will be few ...