Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is shortening MongoDB property names worthwhile?

Tags:

In Blog rolling with mongoDB, express and Node.js the author mentions it's a good idea to shorten property names:

....oft-reported issue with mongoDB is the size of the data on the disk... each and every record stores all the field-names .... This means that it can often be more space-efficient to have properties such as 't', or 'b' rather than 'title' or 'body', however for fear of confusion I would avoid this unless truly required!

I am aware of solutions of how to do it. I am more interested in when is this truly required?

like image 868
raam86 Avatar asked Oct 08 '12 23:10

raam86


People also ask

What should you not use MongoDB for?

One of the downsides of MongoDB is that it doesn't support transactions. Though fewer and fewer applications are requiring transactions, there are still some that need transactions in order to update multiple documents/collections. If that's a necessary function for your team, MongoDB should not be used.

How large should MongoDB documents be?

Document Size Limit The maximum BSON document size is 16 megabytes. The maximum document size helps ensure that a single document cannot use excessive amount of RAM or, during transmission, excessive amount of bandwidth.

What the most important consideration while designing the schema for MongoDB?

When doing schema design in MongoDB there is more to consider than a blanket model for a “One-to-N” relationship model. We need to consider the size of “N” for our modeling because in this instance, size matters. One-to-one relationships can easily be handled with embedding a document inside another document.


1 Answers

To quote Donald Knuth:

Premature optimization is the root of all evil (or at least most of it) in programming.

Build your application however seems most sensible, maintainable and logical. Then, if you have performance or storage issues, deal with those that have the greatest impact until either performance is satisfactory or the law of diminishing returns means there's no point in optimising further.

If you are uncertain of the impact of particular design decisions (like long property names), create a prototype to test various hypotheses (like "will shorter property names save much space"). Don't expect the outcome of testing to be conclusive, however it may teach you things you didn't expect to learn.

like image 140
RobG Avatar answered Sep 30 '22 08:09

RobG