Do short key names actually improve storage efficiency?

I saw this stack overflow post about data being stored in BSON format, and not JSON format.

This makes me think, if you have hundreds of thousand of documents, is it a good idea to for example shorten the field name manufacturing_asset_id to maid to save space?

{
  "manufacturing_asset_id": 14
}
{
  "maid": 14
}

After a bit more searching, I found the section in the documentation about storage optimization for small documents.

As for the _id trick, it seems that depends on whether the data you store has a property that can be uniquely identified, such as timestamps or other IDs that have meaning within some knowledge domain.

I was considering using short/minified keys many years ago, when MongoDB used the mmap engine without compression. Nowadays most deployments (I believe) use data compression so “verbose” keys should not translate into larger storage use. There will be some overhead also in CPU processing, caching and network transfer, but I think key minifying is not worth it for the hassle in application code and in debugging use cases.

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