RAMDISK for filesorts?


I work for a small but rapidly growing web company, I’m a PHP programmer mostly but end up doing a lot of stuff with MySQL as well. Our data set has been growing exponentially, and of course many of our queries are not scaling. The biggest slow down by far seems to be filesorts.

Some of these we have been able to eliminate through tweaking, but some just cannot be eliminated. For those, I thought it would be a cool hack to get MySQL to use ram disk. Our server has 32GB of RAM so we can certainly afford to dedicate a couple of GB to a ram disk.

Has anyone else done this? Suggestions, pointers, caveats? Is this a horrible idea?

For anyone who is wondering, we have increased our tmp_table_size to 128MB to help alleviate some of the filesorts, but we can’t really afford to go higher than that (in fact I’m not sure we should even be that high); our max allowed connections is 500, which means that theoretically more than all of our memory could be used for temp tables…