diff --git a/source/faq/storage.txt b/source/faq/storage.txt index e3f2932d21c..db54df2e0f1 100644 --- a/source/faq/storage.txt +++ b/source/faq/storage.txt @@ -193,6 +193,46 @@ inserted into the database. Consider the following possible causes: running. Be aware that :dbcommand:`repairDatabase` will block all other operations and may take a long time to complete. +After migration to MongoDB, why do my databases use more disk space? +-------------------------------------------------------------------- + +If you migrate existing databases to MongoDB, your MongoDB installation +might take up significantly more disk space than your previous +installation. There are a number of factors that can explain this +difference, the most common of which is preallocation. + +The following factors affect database instance size: + +- Preallocation. MongoDB preallocates disk space for databases upon + creation to facilitate responsive write performance. For an + explanation of preallocation, see :ref:`faq-disk-size`. + + To see how much space MongoDB has allocated for document storage for a + database, use the :dbcommand:`dbStats` command. + +- Document update patterns. To minimize document movements, which can + adversely affect performance, MongoDB adds :ref:`padding + ` to documents in anticipation of + updates that change the sizes of documents. MongoDB adaptively learns + if documents in a collection tend to grow, and if your update patterns + often change document sizes, then MongoDB increases the factor used to + allocate padding, thus increasing disk storage. For more information, + see :ref:`write-operations-padding-factor`. + + To see the padding factor for a given collection, use the + :dbcommand:`collStats` command. + + For an approach to document growth, see + :doc:`/use-cases/pre-aggregated-reports`. + +- Data model. In small databases especially, document structure and + database organization affect the amount of disk space used. See + :ref:`faq-small-documents`. + +To compact storage space for a collection, run the :dbcommand:`compact` +command, but only run it during scheduled maintenance periods. The +:dbcommand:`compact` command is slow and blocks other database use. + How can I check the size of a collection? -----------------------------------------