Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I'm curious if SO uses any compression algorithm to reduce storage space of posts?

Or is this an unnecessary overhead since storage is cheap?

share|improve this question
up vote 9 down vote accepted

No. Compressing the data in storage would cause a HUGE performance penalty. Hard drive space is way too cheap to save the few pennies you would gain. But the data is gzipped (compressed on the fly) before it is transmitted to increase the speed the data is received.

share|improve this answer

This answer is a little trickier than Robert implies in his answer.

SQL Server 2008 introduced data compression as a feature in Enterprise Edition. Pages are compressed before they're written to disk automatically, but only for the objects you choose - not just at the table level, but at the index level. I might have a list of users that I keep compressed (because they have huge about-me profiles that compress very well with low CPU overhead) and a list of indexes that I keep uncompressed (because I hit those constantly).

At first glance, it would seem like compression would slow things down, but that's not usually the case with database compression. It turns out that in most cases, we're waiting on disk anyway, and if we can write less to disk by doing some quick CPU calculations, the overall query time will decrease. CPU load goes up, but query time goes down, and SQL Server spends less time switching between tasks waiting for stored data. SQL Server's compression works very well for OLAP style data - huge volumes of data that aren't changed very frequently.

However, one of the areas where it doesn't perform as well is OLTP-style data where pages are constantly changing, like StackOverflow's setup.

If we partitioned off the older data (questions that are stale), we could get a performance boost, but partitioning has its own drawbacks, and I've written about that:

share|improve this answer

Storage is cheap. Bandwidth isn't. So theirs probably compression of the stream of data somewhere.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .