Large database - too much time spent opening and closing tables I have a MySQL server (5.5.31) with 450 databases of some 200 tables each. (Yes, 90,000 tables)

When we're under high load, there's over 100 concurrent queries, of which 70% are either opening or closing tables. They're all only open for small queries.

The machine is heavily swapped, so obviously I can throw some RAM at it.

But before that, is there anything in the config I should be looking at? We've used various tuning tools, but they seem heavily geared to a more normal database setup where you might realistically have all tables open at any one time. Last time we changed our settings to match those recommended by a tuning tool, the entire system came to a halt.

What particular tuning should I be looking to to be able to get maximum performance before we throw RAM at it?
Generally throw RAM at it - especially given that you do not even say how much RAM you have. DAtabases love WARM and unless you are in the way to change the number of tables (90k is QUITE a lot) then basically thow RAM at it.

At least until you reach the low end of a low end database serer - which at these days would be 32gb memory (full memory loadout for a low end single processor Xeon).