首頁 資料庫 mysql教程 MongoDB Tip: The touch Command

MongoDB Tip: The touch Command

Jun 07, 2016 pm 04:29 PM
command mongodb the touch

MongoDB 2.2 introduced the touch command, which loads data from the data storage layer into memory. The touch command will load a collection’s documents, indexes or both into memory. This can be ideal to preheat a newly started server, in

MongoDB 2.2 introduced the touch command, which loads data from the data storage layer into memory. The touch command will load a collection’s documents, indexes or both into memory. This can be ideal to preheat a newly started server, in order to avoid page faults and slow performance once the server is brought into production. You can also use this when adding a new secondary to an existing replica set to ensure speedy subsequent reads.

Note that while the touch command is running, a replica set member will enter into a RECOVERING state to prevent reads from clients. When the operation completes, the secondary will return to the SECONDARY(2) state.

You invoke the touch command through the following syntax:

db.runcommand({ touch: “collection_name”, data: true, index: true})
登入後複製


Here you indicate which collection to touch and whether or not you want both documents (data) and/or indexes to be loaded into memory. Index and data are both off by default, so you will need to indicate at least one as “true” to have any effect on your server. Otherwise you will see the following message:

db.test.runCommand(“touch”)
 ???????"ok" : 0,
 ???????"errmsg" : "must specify at least one of (data:true, index:true)
登入後複製

touch is non-blocking on a mongod process, so you can run it concurrent with other commands.


For a full list of MongoDB commands, check out the Database commands in the MongoDB Manual

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前 By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

mongodb一般用哪個版本 mongodb一般用哪個版本 Apr 07, 2024 pm 05:48 PM

mongodb一般用哪個版本

nodejs和vuejs區別 nodejs和vuejs區別 Apr 21, 2024 am 04:17 AM

nodejs和vuejs區別

2 個月不見,人形機器人 Walker S 會摺衣服了 2 個月不見,人形機器人 Walker S 會摺衣服了 Apr 03, 2024 am 08:01 AM

2 個月不見,人形機器人 Walker S 會摺衣服了

mongodb建立的資料庫在哪裡 mongodb建立的資料庫在哪裡 Apr 07, 2024 pm 05:39 PM

mongodb建立的資料庫在哪裡

mongodb資料庫的優勢有哪些 mongodb資料庫的優勢有哪些 Apr 07, 2024 pm 05:21 PM

mongodb資料庫的優勢有哪些

mongodb是什麼意思 mongodb是什麼意思 Apr 07, 2024 pm 05:57 PM

mongodb是什麼意思

mongodb資料庫檔案在哪 mongodb資料庫檔案在哪 Apr 07, 2024 pm 05:42 PM

mongodb資料庫檔案在哪

mongodb怎麼開啟 mongodb怎麼開啟 Apr 07, 2024 pm 06:15 PM

mongodb怎麼開啟

See all articles