<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                一、創建索引 MongoDB提供了對文檔集合中任何字段進行索引,默認情況下在_id字段進行索引。 * 單鍵索引 ,在單個字段上創建升序索引 ~~~ > db.records.find() { "_id" : ObjectId("5a97ceafc1670638c95ceb9c"), "score" : 1034, "location" : { "state" : "NY", "city" : "shanghai" } } > db.records.createIndex({score:1}) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 3, "numIndexesAfter" : 3, "note" : "all indexes already exist", "ok" : 1 } 說明: 1)1表示按升序,-1表示按降序 2)在該字段上創建了索引,就支持通過該字段加速查詢 3)background:true,表示后臺構建索引 4)unique:true 唯一索引 > db.records.find({score:{"$gt":1020}}) { "_id" : ObjectId("5a97ceafc1670638c95ceb9c"), "score" : 1034, "location" : { "state" : "NY", "city" : "shanghai" } } ~~~ * 多鍵索引 ~~~ > db.records.createIndex({"location.state":1}) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 3, "numIndexesAfter" : 4, "ok" : 1 } ~~~ * 組合索引 格式: db.collection.createIndex( { <field1>: <type>, <field2>: <type2>, ... } ) > db.products.createIndex({"item":1,"stock":1}) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } * 文本索引(text indexes) * hash索引(Hash indexes) 二、查看索引 1)db.people.getIndexes() > db.records.getIndexes() 三、刪除索引 > db.records.dropIndex({"score":1}) { "nIndexesWas" : 4, "ok" : 1 } 四:使用explain()返回查詢計劃 > db.foo.find({age:{"$gt":20}}).explain("executionStats") "executionStats" : { "executionSuccess" : true,-----是否執行成功 "nReturned" : 2,------查詢返回的條數 "executionTimeMillis" : 1,------整體執行時間 "totalKeysExamined" : 2,-------索引掃描次數 "totalDocsExamined" : 2,-------文檔掃描次數 管理索引 * 查看集合中索引在磁盤上的存儲大小 > db.foo.stats().indexSizes { "_id_" : 36864, "age_1" : 16384 } 單位為byte * 查看各索引具體內存占用大小 > db.foo.stats({indexDetails:true}).indexDetails 索引狀態 > db.foo.aggregate([{$indexStats:{}}]) { "name" : "age_1", "key" : { "age" : 1 }, "host" : "node1.51yuki.cn:27017", "ac cesses" : { "ops" : NumberLong(2), "since" : ISODate("2018-03-08T08:01:52.801Z") } } { "name" : "_id_", "key" : { "_id" : 1 }, "host" : "node1.51yuki.cn:27017", "acc esses" : { "ops" : NumberLong(0), "since" : ISODate("2018-03-01T06:48:40.845Z") NumberLong,索引調用次數
                  <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>

                              哎呀哎呀视频在线观看