MongoDB教育訓練-06
mongoDB 使用B-tree索引
查詢至少要用到索引,不要full table scan(所以要至少建立可用索引)
檢查執行計畫快取 -> (無) 有可能優化的索引找出來,同時跑看誰的效率快,加入快取
更新快取時機:
- 當前索引變慢(系統判斷)
- 當新的索引被創建
- server 重啟(memory 清除)
- 需要指定欄位
- 欄位可以是任何類型
Explain 執行計畫
- queryPlanner : 只顯示執行計畫
- nReturn: 返回數量
number_of_reviews: 1 (1: 升冪,-1:降冪)
通過index 取得資訊:FETCH
- nReturn:totalKeyExamined:totalDocExamined 1:1:1 最佳情況
取得所有索引
刪除索引


















