explain("executionStats") cho biết query dùng index nào, docs/keys examined, docs returned, stage tree và thời gian thực thi. Mục tiêu là keys/docs examined gần với số docs returned, không phải scan quá rộng.
Ví dụ:
javascript
db.orders.find({ tenantId: "t1", status: "paid" }).explain("executionStats")Nếu thấy COLLSCAN, docs examined rất lớn hoặc sort in memory, cần xem lại index/query shape/projection.