Is there a performance penalty for _id that does not increase monotonically?

I wonder if it’s better to use monotonically increasing _id because of problems like “page split” in RDB.

Doesn’t anyone know?

Hello @KD_K ,

Welcome to MongoDB community! :wave:

"_id" has no connection to how documents are stored physically on the disk. It is the primary key of a collection, (see _id), and as far as I am aware, it does not influence how the WiredTiger Storage Engine stores documents.

In fact, monotonically increasing "_id" can be detrimental in some applications, like Sharding (if _id is used as shard key). For reference, please check this documentation on Monotonically Changing Shard Keys.

However, are you facing any issue in your deployment that you feel may or may not be caused by page splits?

Regards,
Tarun

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.