December 3, 2018

Thunderbird gets SLOW!

A symptom of poor programming, but we seem to be stuck with it. I have found two things that make a big difference.

Thunderbird slow due to huge inbox

I run Thunderbird on a Fedora Linux system (currently Fedora 25).

Over the past few weeks, Thunderbird has become terribly slow to display and to compose emails. If you do searches on this, you will find many discussions about some calendar plugin causing this problem. This may well be an issue, but it is not my problem as I do not use any calendar add-on or extension or whatever it might be called. Some people seem to think that Thunderbird is slow working with Google via IMAP, which is simply untrue. A lot of people running windows have issues with antivirus software interfering with Thunderbird, which is not my problem.

My problem is more basic. I keep all of my mail in the inbox (where else would you keep it?). This is fine for quite some time, but then (in my experience) some critical threshold is reached and things very suddenly become very slow.

I look in the .thunderbird directory in my home directory. In particular, I look at:

cd .thunderbird/y4he6kw8.default/ImapMail/imap.gmail.com
ls -l INBO*
-rw-------. 1 tom tom 6871498335 May 29 11:12 INBOX
-rw-rw-r--. 1 tom tom   19678956 May 29 11:13 INBOX.msf
And there you have the issue, almost 7G of email in my inbox. You will also read recommendations about "compacting" your inbox, but this is the least of my problems. This is 22535 messages. Everything I have received since January 1, 2015 (2.5 years worth of mail).

Get rid of trash

Right click on the trash folder and "empty" the trash. This turned out to be the answer to a slow Thunderbird that was slow even after moving most of my inbox to an Archive folder (which had previously solved this problem).

Compacting folders

This has never made any noticeable effect that I can see, but it is supposed to be a good thing.

Click on the "hamburger" icon in the upper right. Select "File" and then "Compact Folders". It looks like this is an all or nothing busines. To compact a single folder, right click on that folder and select "Compact". Rumors are that Firefox does this automatically now and then.

Archiving mail - executive summary

Make sure the target directory exists. If it doesn't, right click on "Archive" (on the left side of T-bird) and use "create folder" to make it.

Make sure the inbox is selected. Right click to get menu and use "Search messages".

You now have the search dialog. Select "Date", "is before", and something like 1/1/2018. Then click the search button at upper right. Use Control-A to select all that it finds. Then use "move to" and tell it to move to "Archive/2017" or some such.

When I did the "move to" in 2020, I had 14,633 messages and it took many minutes. I was all but sure Thunderbird had locked up and would need to be restarted. It takes patience dealing with crappy software like this.

After this I generally will compact folders.

Archiving mail - the long explanation

There are settings to govern this in the "Account Preferences". To get to this, click on the "hamburger" icon. Preferences has a submenu that includes "Account Preferences". In the second submenu (Copies and Folders) there is a section entitled "Message Archives", with various options. I select "Archives folder on local folders" and under archive options, select yearly folders.
This apparently did absolutely nothing, and when I restarted Thunderbird, this setting change was gone.

The idea in the above sounds fine though, so lets create an Archive folder with yearly subfolders. Right off of my user name, I right click and create an Archive folder, this sits alongside Inbox. Inside here, I create 2015, 2016, and 2017.

The following is not the right way to do this, but is what I did for my 2015 mail. I select "tom@" on the top and I get offered a search dialog. I search on "Date is before 1/1/2016" and it quickly picks 40,000 messages. I use Control-A to select all of these messages. Then I select "move to" and tell it to move to Archive/2015. I get several warnings about a script being busy or unresponsive. Ultimately I have to stop and restart Thunderbird.
This was BAD as it moved stuff out of all kinds of other folders besides my inbox and crammed it all into a flat 2015 folder, it did not nicely mirror the folder structure as I expected.
We may just have to delete this 2015 mess now, much as I hate that.

What we really want to do is just work on the inbox. On the left side of Thunderbird, I left click to select my inbox, rather than selecting "tom@" at the top of the folder list. I verify that all of the 2015 entries are gone. A right click gives me a menu that includes "Search Messages", selecting this gives me a search dialog. I do a search for "Date is before 1/1/2017". I use Control-A to select all that and then "move to" to move it to Archive/2016
I get more puzzling unresponsive script errors. Ultimately I have to stop and restart Thunderbird.

Note that when I do smaller moves, it does take a while, but I don't get odd errors and it works as it should.

One final move from the inbox for 2017, Everything (for now) prior to 4/1/2017. This actually goes cleanly and leaves me with 1930 messages in my inbox. (Do I really receive 1000 messages a month? That would be 30 per day, which does seem plausible).

After this massive move, I tell it to compact folders. And now things seem nice and snappy.

You can also reach the search dialog using the "hamburger", but I am not sure of the benefit of doing that.


Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org