I noticed that MongoDB database indexes take more space in MongoDB 5 than in MongoDB 4. I verified the phenomenon by testing as follows:
- export (mongoexport) sample data of 100.000 documents out of some test environment (documents have MongoDB ObjectIds included)
- import (mongoimport) these data to a fresh MongoDB 4.2.22 and a fresh Mongo 5.0.11 database
- compare the collection statistics
Test-Result:
- same avgObjSize of 495 bytes in MongDB 4 and 5
- different avgIndex Size of _id-Index
- MongoDB 4 → 10 bytes
- MongoDB 5 → 19 bytes
Does anyone know what causes this difference?