Search code examples
mysqltemp-tables

mysql TEMPORARY TABLE stored in ram?


I've developed a small c# application that uses quite intensive Database calculations. I am hosting my application in a shared hosting environment. I am getting :

mysql out of memory exception

I am using quite a lot of temporary tables. Where are these tables stored? Could this be the reason for this error?

Thank you


Solution

  • Temporary tables are stored in memory, but if the temporary table gets too large it will get moved to the file system. Lots of temporary tables can definitely eat up a lot of memory and cause other kinds of performance problems as well. Also, large result sets can cause similar issues, so it's a good idea to check you're only fetching what you need and that the keys and indexes are correctly defined.