<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ### 索引創建的注意事項 > 當如果數據量比較大時,最好使用后端方式進行創建,不然會阻塞mongodb的讀寫操作,就很悲劇了。 > db.col.createIndex({"filed":1}, {background:true}); ### 索引的性能檢查 > db.col."sql".explain("executionStats"); > 結果中: > winningPlan:最佳匹配的索引。 > docsExamined:1000,檢查了1000個文檔 > nReturned:13,匹配到了13個文檔 > executionTimeMillis:當前查詢所需時間,毫秒數 > indexBounds:當前查詢具體使用的索引 ### 索引的管理 > 查詢所有索引 ``` db.col.getIndexes() ``` > 刪除所有索引 ``` db.col.dropIndexes() ``` > 刪除 firstname 索引 ``` db.col.dropIndex({"firstname": 1}) ``` ### 索引的分類 #### 1. 單鍵索引 > 索引創建:db.col.createIndex({"filed":1 or -1}) > 查詢語句:do.col.find({"field":"wangkun"}) > 1為升序,-1 為降序 #### 2. 唯一索引 > 當插入相同的值時候會報錯,以保證數據的唯一性 > 索引創建:db.col.ensureIndex({"field": 1}, {unique: true}); > 查詢語句:do.col.find({"field":"wangkun"}) #### 3. 復合索引 > 索引創建:db.col.createIndex({"field1":1,"field2":-1}) > 查詢語句:db.col.find({"field1":"value","field2":"value"}) > 可以用field1做前綴進行查詢 > 也可以用field1 + field2 進行查詢 > 切勿使用field2 + field1 進行查詢 #### 4. 多鍵值索引 > 索引創建:db.col.createIndex({"array filed":1 or -1}) > 查詢語句:do.col.find({"array field":122}) #### 5. HASH索引 > 索引創建:db.col.createIndex({"filed":"hashed"}) > 查詢語句:do.col.find({"field":"wangxi"}) > 定值查找,o(1) 時間消耗 #### 6. 局部索引 > 局部索引可以 節約存儲空間 和 性能消耗。 > 比如 年齡大于10歲的數據都進行索引 > 索引創建:db.col.createIndex({"age":1}, {partialFilterExpression:{"age":{$gt:10}}}}) > 查詢語句:do.col.find({"age":22})
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看