MySQL Reference Manual for version 3.23.5-alpha. How MySQL uses memory 10.2 How MySQL uses memory The list below indicates some of the ways that the mysqld server uses memory. Where applicable, the name of the server variable relevant to the memory use is given. When a query is running a copy of the current query string is also allocated.
All threads share the same base memory.
This is because the 32-bit memory space of 4GB is not large enough for most large tables. All joins are done in one pass and most joins can be done without even using a temporary table. Most requests doing a sort allocate a sort buffer and one or two temporary files. Where MySQL stores temporary files . Almost all parsing and calculating is done in a local memory store.