reduce duplicated logic
I made a git mistake. this change tries to recover.
Rewrite broken query instead of making untested tweaks to parts thereof

The reason I used DISTINCT ON (not DISTINCT) in the first place was that
m.rfc822size can't be selected directly with a GROUP BY. But fortunately
the inner query isn't needed at all. The rewritten version is marginally
faster than the old one and the proposed alternative using GROUP BY.
temporary workaround for the phtreads/ssl problem

if pthreads refuses to create more threads, restart the server PDQ

still need to do more analysis and find out what the breakage is
More gittery to unfuck my fat-fingered typing from earlier this week