After our upgrade to 3.8.8 today, I spent some time to figure out why some things are still slow. Of particular note it was really really slow to reply to a specific correspondence on a ticket with lots of attachments. I noticed that RT was just spending all of that time waiting on this query:
SELECT main.* FROM Attachments main WHERE (main.Content IS NOT NULL AND main.Content != ‘’) AND (main.Parent = ‘1429741’) AND (main.ContentType = ‘text/plain’) ORDER BY main.id ASC
On my attachments table with 1.2 million rows, this is doing a sequence scan. I added an index on the Parent field, and now it is nearly instant, and normal page loads seem to be a bit faster as well.