I found this tip on the Hawk Wings site (a blog devoted to tips and add-ons for Apple Mail). I tried it out and saw a pretty dramatic speed improvement so I’ll post it here.
1. Quit Mail.
2. Open Terminal.
3. Type the following:
sqlite3 Envelope\ Index
An sqlite> prompt will appear. At that prompt, type:
sqlite> vacuum subjects;.
After a short delay, the prompt will return.
Type Control-D to exit.
4. Restart Mail and enjoy the extra speed.
I’m guessing the degree of speed improvement you’ll see depends on the size of your â€œEnvelopeâ€ file and the length of time you’ve been using Apple Mail. I just switched over from Thunderbird a month or so ago (I seem to switch back and forth about every 6 months) so I didn’t see much shrinkage in the Envelope file but I did see an immediate and noticeable improvement in the on-screen performance of Mail.