Ultimately, with this large collection I'll have, I just don't want to see performance slow down over time due to something I'm missing.
Thanks in advance for any help!
Hi Matt
Do you just create the index once, and the efficiency will maintain itself over the life of the collection? Or do you have to rebuild the index every so often?
You just need to create the index once. It will be maintained as part of the insert/update process.
Also, coming from DB2 background, there is the concept of a table ‘reorg’ where ordering and pages get rebuilt to maintain structure and efficiency of the tables data. Is there an equivalent in Mongo?
There is no direct equivalent of the reorg command in MongoDB. The closest equivalent is maybe compact
, but running compact
regularly is not necessary to maintain performance.
Ultimately, with this large collection I’ll have, I just don’t want to see performance slow down over time due to something I’m missing.
If your queries are well-indexed and you have sufficient hardware resources so that MongoDB does not need to fetch from disk very often, performance should not be an issue. Even if the collection keeps growing, as long as the “working set” can comfortably fit in RAM, MongoDB should be able to maintain its performance.
Having said that, please note that unlike tabular databases e.g. DB2 which was designed to run within a single big machine, MongoDB is a distributed database. Hence, in a production environment, it’s strongly recommended to run a replica set to provide high availability and redundancy.
Best regards
Kevin