Skip to content

1.5 Data Storage

Olga Arsenieva edited this page Sep 26, 2018 · 1 revision

1.5 How MongoDB stores data on-disk?

How SQL Server stores file ?

  • A record, also known as a row, is the smallest storage structure in a SQL Server data file.

  • Data records are stored in a fixedvar format

    FixedVar

  • SQL Server organizes and stores records in smaller units of data, known as pages. 

  • A page is always exactly 8 KB (8192 bytes) in size and contains two major sections, the header and the body. The header has a fixed size of 96 bytes and has the same contents and format, regardless of the page type. It contains information such as how much space is free in the body, how many records are stored in the body, the object to which the page belongs and, in an index, the pages that precede and succeed it.

    Page

How MongoDB Stores Data on-disk?

  • MongoDB is a document-oriented database.

  • Instead of storing your data in tables made out of individual rows, like a relational database does, it stores your data in collections made out of individual documents.

  • In MongoDB, a document is a big JSON blob with no particular format or schema.

  • WiredTiger Storage Engine. Default for all versions is currently WiredTiger. It is multithreaded and benefits from use of XFS file system. WiredTiger uses document-level concurrency control for write operations. As a result, multiple clients can modify different documents of a collection at the same time.

  • A given mongo database is broken up into a series of BSON files on disk, with increasing size up to 2GB. BSON is its own format, built specifically for MongoDB. MongoDB stores the data on the disk as BSON in your data path directory, which is usually /data/db.

    Data File Allocation

To Sum Up

BSON Encoding

Clone this wiki locally