I’m considering optimizing our database by adding and removing indexes. I’m also enabling oplog tailing.
From my understanding, because MongoDB indexes speed up finds and slow down inserts, they are useful for collections that are read more often than written.
We’re publishing part of a collection with a
collection.find() query, and I enable oplog tailing. Does this mean the query will from now on only be run once (when the user subscribes) and after that all updates will come directly from the oplog and the query won’t be run again against MongoDB?
This would imply that (in the case of a
chat_messages collection for instance, where the user joins the chatroom (and thus subscribes) once and then sends various messages) the collection will now be written more than read. Therefore, it’s better to not use indexes.
Is my reasoning correct?