Monday, July 28, 2008

Massive folders in Thunderbird? Compact them down to size.

A little tip that I thought I would share, because I just found out about it.

I just backed up my computer and, when choosing the files to backup noticed that my inbox was several gigabytes. I'm a busy web designer and receive all kinds of files, so didn't think too much about it.

I backed up the computer and then went about cleaning up the inbox. I moved all files older than 3 months out, cleaned up the trash and then checked again. Still 2.1Gb. Even though there were 'only' 300 messages in the inbox. Very strange.

Much searching later and learning about things like 'expunge' and I found the answer.

Thunderbird does NOT delete your messages from disk when they are deleted from view. Deleting them just hides them from view:

This is from Mozilla's website:
When you delete or move a message most e-mail clients simply hide the message and mark it as ready for physical deletion later on. These hidden messages still remain in the folder. Even emptying the Trash does not physically delete them. These hidden messages are not physically removed until the folder is compacted. If you don't compact your mail folders periodically, they can grow very large, and erratic program behavior may occur.

The next paragraph was more enlightening:
Many users have never heard of compacting folders (not to be confused with compressing a file). However, most e-mail clients do this to improve performance by not requiring the e-mail client to rewrite the entire folder every time you delete a single message. The reason you might never have heard of compacting is that most e-mail clients default to automatically compacting the folder whenever a certain amount of space is wasted, while you have to enable this in Thunderbird.


And there was me, all this time, thinking that "compact folder" meant that it would be compressed (e.g. with a zip algorithm) and that this would REDUCE the performance of the folder in favour of using less disk space. Little did I know that it would IMPROVE the performance AND use less disk space!

So, there are two recommendations.

  1. If you want to clean up your folders manually, right click them and then click "Compact".
  2. If you want to automatically compact your folders go to:
    Tools -> Options -> Advanced -> Network & Disk Space -> Disk Space
    Tick the box and put a sensible number in the "Compact folders when it will save x kb" box (e.g. I just put in 10000 for 10Mb)
For your amusement, you might like to see some stats:
My inbox before compacting: 2149840 bytes
My inbox after compacting: 9816 bytes
A reduction in size of 99.5%

Now, if only I had done this before buying all those extra Gb of offsite backup from Mozy...