02 มกราคม 2566

MongoDB index optimization (ESR rule, Compound Indexes, Index Cardinality)


 List of good tutorials related to MongoDB index




ESR rule summary
  • ESR: Equality comes first, then Sort and Range, for example


  • $ne or $nin are range operators, not equality operators
  • $regex are range operator
  • $in can be an equality operator or a range operator. When $in is used alone, it is an equality operator that does a series of equality matches. $in acts like a range operator when it is used with .sort(). For example



Compound Indexes

  • Sort on Multiple Fields

  • Sort and Index Prefix


  • Sort and Non-prefix Subset of an Index





Index Cardinality
from e-book "MongoDB: The Definitive Guide: Powerful and Scalable Data Storage"









ไม่มีความคิดเห็น:

แสดงความคิดเห็น

บทความยอดนิยม (ล่าสุด)

บทความยอดนิยม (1 ปีย้อนหลัง)