bson compression rate

1,680 views
Skip to first unread message

Baruch Sadogursky

unread,
Jul 11, 2010, 7:12:11 AM7/11/10
to mongodb-user, erez....@retalix.com
Hi, all!

I have a question on the subj. While I understand BSON can't be just
BLOB, because MongoDB needs to get into it in cheap way, still the
numbers seem a little odd to me: my JSON string is about 80K and
Object.bsonsize() returns ~28.5K, which gives less than 1:3
compression rate.
Are those making sense or am I doing something wrong?

Thanks a lot!
Baruch.

Geir Magnusson Jr.

unread,
Jul 11, 2010, 8:12:51 AM7/11/10
to mongod...@googlegroups.com
Just curious - why would you expect a higher ratio?

The BSON doc contains all the key strings, so there's no reduction in size there, and you're going to 'swap' all the JSON 'structural' data ({,:[]"}) for BSONs structural data (type information, size information....)

> --
> 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.
>

Baruch Sadogursky

unread,
Jul 11, 2010, 11:04:39 AM7/11/10
to mongodb-user
Yeah, probably you are right. For some reason I was under
misconception that text-to-binary provides higher compression rate.

Michael Dirolf

unread,
Jul 11, 2010, 11:08:03 AM7/11/10
to mongod...@googlegroups.com
You also might want to check out the first FAQ, here:
http://bsonspec.org/#/faq

Baruch Sadogursky

unread,
Jul 12, 2010, 3:09:01 AM7/12/10
to mongodb-user
Thanks for the link. That explains it.

On Jul 11, 6:08 pm, Michael Dirolf <m...@10gen.com> wrote:
> You also might want to check out the first FAQ, here:http://bsonspec.org/#/faq
>
> On Sun, Jul 11, 2010 at 11:04 AM, Baruch Sadogursky
>
Reply all
Reply to author
Forward
0 new messages