![]() It is a best practice to use shorter field names when possible. Field names are defined in every document. The tradeoff is that with greater flexibility comes greater use of space. New fields can be added to a document without affecting other documents, and without registering the fields in a central catalog. In MongoDB there is currently no central catalog: each document is self-describing. This approach is efficient in terms of space, but it requires all data to be structured according to the schema. Column names are stored once for all rows. In most databases, the schema is described and maintained centrally in a catalog or system tables. One of the things users love about MongoDB’s document data model is dynamic schema. However, BSON does not compress data, and it is possible its representation of data is actually larger than the JSON equivalent. BSON is efficient to encode and decode, and it is easily traversable. MongoDB stores data in BSON, a binary encoding of JSON-like documents (BSON supports additional data types, such as dates, different types of numbers, binary). There are two important features related to storage that affect how space is used in MongoDB: BSON and dynamic schema. In these cases more data can fit in RAM, which improves performance. ![]() In terms of RAM, some compressed formats can be used without decompressing the data in memory. By decreasing the size of the data, fewer disk seeks will be necessary to retrieve a given quantity of data, and disk I/O throughput will improve. Disk I/O latency is dominated by seek time on rotational storage. Size is one factor, and there are others. In other words, it still pays to look for ways to reduce your storage needs. Your internal costs might also incorporate management and other factors, so they may be significantly higher than commodity market prices. Why compression?īut chances are you’re adding data faster than storage prices are declining, so your net spend on storage is rising. As always, YMMV, so we encourage you to test your own data and your own application. ![]() ![]() In this post we will take a look at the different options, and show some examples of how the feature works. MongoDB 3.0 introduces compression with the WiredTiger storage engine. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |