I want to implement a partial index that indexes a subset of documents in my collection where documents in this subset contain a shared field not used in other documents outside the subset. Call this shared field "subset_field".
I know that using a partial index reduces the size of the index in memory, but when I want to insert new documents that do not have the shared "subset_field", will the partial index slow down the insert operation as much as a regular field index would?
The documentation on partial indexes only mentions insertation in regards of unique fields:
A partial index with a unique constraint does not prevent the insertion of documents that do not meet the unique constraint if the documents do not meet the filter criteria.
But the doc on Write Op Performance does have a big note saying
MongoDB only updates a sparse or partial index if the documents involved in a write operation are included in the index.
So, the partial index is being used to check if it applies to the document but if it doesn't apply then the index update is skipped hence your performance improves.