set up a test set one, which has 100 million documents and about 6.3G document data. A total of three indexes have been established. As shown in the figure above, the three indexes are all in the size of 1G, and the three indexes have a total size of 3.2G.
when querying this collection for the first time, the query condition does not use index fields, and a full table scan of 100 million items is performed. From the memory usage, we can see that the memory usage is constantly soaring, increasing by about 6 gigabytes.
after finishing the Mongo process, restart to query the index field, and instantly find the target document, but do not see any change in the memory usage (that is, the memory usage has increased by about 100m when starting the mongodb process), but any of the three indexes are 1G in size. Has mongodb loaded the index data into memory in the end?!?
how exactly does mongodb use index data? If it loads it into memory, why is the memory footprint basically unchanged? For the three indexes in the figure above, if the only query uses only the index query of field c, does mongodb load only 1.1g of the data of the index of field c, or load all 3.2g of the data of all three indexes directly?