databasemongodbwiredtiger

Is MongoDB WiredTiger using clustered index?


Is WiredTiger using clustered index on _id or just non-clustered index when it is as the storage engine of MongoDB? Is there any way to manage it?


Solution

  • As of MongoDB 4.0.6, WiredTiger does not use clustered index for the _id field.

    Actually there is no facility to create clustered index in MongoDB using WiredTiger currently.

    See SERVER-3294 for the discussion regarding adding this feature to MongoDB.

    EDIT: As Arjun mentioned in the other answer, it is possible to create a clustered index from MongoDB 5.3 (thanks Arjun!). However it comes with a set of limitations: https://www.mongodb.com/docs/v5.3/core/clustered-collections/#limitations but it also comes with certain advantages as well. So if you're thinking about using this feature, please do test it extensively before deploying it in production.