Compressing Field Names?

57 views
Skip to first unread message

Idris

unread,
Jun 11, 2010, 11:56:20 AM6/11/10
to mongodb-user
On this page: http://www.mongodb.org/display/DOCS/Optimizing+Storage+of+Small+Objects
it suggests "using small field names" as a method of optimizing
storage (but not for indexes).

Wouldn't it make sense if mongodb did this automatically? Perhaps it
could keep a map on disk and in memory of long-key-name => compressed-
key-name. In the storage, it would only use the compressed-key-names,
but querying, results, etc. would all use the full key name.

Kristina Chodorow

unread,
Jun 11, 2010, 12:09:09 PM6/11/10
to mongod...@googlegroups.com
Wouldn't it make sense if mongodb did this automatically?
 
As a general design philosophy, the database tries to do very little processing stuff to stay lean and fast.  It's supposed to be a big, dumb data store and push whatever functionality it can to the client side.

Also, in most cases, you're not saving much space.  Suppose you mapped all of your keys to 1-character strings.  If this reduced your document size by, say, 40 bytes and you have a million documents, you're saving all of 40MB. 



--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


Michael Dirolf

unread,
Jun 11, 2010, 12:42:45 PM6/11/10
to mongod...@googlegroups.com
I think a more important difficulty with something like that is that
the key-name mapping would have to be coordinated to all nodes when
doing sharding, etc. Hard to do since we allow dynamic "schemas".

Roger Binns

unread,
Jun 14, 2010, 4:23:09 PM6/14/10
to mongod...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/11/2010 08:56 AM, Idris wrote:
> On this page: http://www.mongodb.org/display/DOCS/Optimizing+Storage+of+Small+Objects
> it suggests "using small field names" as a method of optimizing
> storage (but not for indexes).

Try using "smaz" with your own code to see what kind of results you get
and report back here. (You need to alter keys on updates and retrieval
as well as indices etc.)

Note that the wiki doc is about really small objects where the key names
are a non-trivial portion of the overall encoded object representation.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwWj6gACgkQmOOfHg372QQOpwCg3k8mc0641kyML47Xic0/aFFk
kgEAnRWB3GcjX9P6R3BYT5ckOV4PcqV3
=PLJU
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages