Skip to content

DOCS-773 faq on mongodb storage #1063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions source/faq/storage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
<write-operations-padding-factor>` 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?
-----------------------------------------

Expand Down