After 4.2, background createIndexes

Hi @Kim_Hakseon,

Unlike foreground index builds in prior server releases, 4.2+ index builds do not block database access while an index is being created.

There are further details in the two links you shared in your post, but the Behaviour section addresses this specifically (my performance quote above is from the same section):

Starting in MongoDB 4.2, index builds obtain an exclusive lock on only the collection being indexed during the start and end of the build process to protect metadata changes. The rest of the build process uses the yielding behavior of background index builds to maximize read-write access to the collection during the build. 4.2 index builds still produce efficient index data structures despite the more permissive locking behavior.

The new index build approach effectively delivers the previous benefits of background index builds with the potential efficiency and performance of foreground index builds depending on resource contention.

Regards,
Stennie

1 Like