jux
jux

Reputation: 79

How MongoDB manage data after inserting?

After data is inserted into the db, I know that MongoDB stores the data in files, however, I'm confused about memory.

Supposing when I will insert 50 million records into the db - will this data be loaded in memory? If not, how does MongoDB behave to keep its performance?

Upvotes: 0

Views: 47

Answers (1)

profesor79
profesor79

Reputation: 9473

In that case documents are loaded into memory on request by blocks, that mean our collection is split-ed into chunks, and most frequent used chunks resides in memory. To gain performance mongo uses indexes and there is a special query called coved query which means that all data needed is stored in index, which is smaller than collection.

Upvotes: 1

Related Questions