Optimizing Memory Use column structures for each column, and a buffer of size  3 *  N  are allocated (where  N  is the maximum row length, not counting  BLOB  columns). A  BLOB  column requires five to eight bytes plus the length of the  BLOB  data. The  MyISAM  storage engine maintains one extra row buffer for internal use. For  MEMORY  tables explicitly created with  CREATE TABLE , only the  max_heap_table_size  system variable determines how large a table can grow, and there is no conversion to on-disk format. The connection buffer and result buffer each begin with a size equal to  net_buffer_length  bytes, but are dynamically enlarged up to  max_allowed_packet  bytes as needed. The result buffer shrinks to  net_buffer_length  bytes after each SQL statement. While a statement is running, a copy of the current statement string is also allocated. Each connection thread uses memory for computing statement digests. The server allocates max_digest_length  bytes per session. See Section 27.10, “Performance Schema Statement Digests and Sampling” . •All threads share the same base memory. •When a thread is no longer needed, the memory allocated to it is released and returned to the system unless the thread goes back into the thread cache. In that case, the memory remains allocated. •Each request that performs a sequential scan of a table allocates a  read buffer . The read_buffer_size  system variable determines the buffer size. •When reading rows in an arbitrary sequence (for example, following a sort), a  random-read buffer  may be allocated to avoid disk seeks. The  read_rnd_buffer_size  system variable determines the buffer size. •All joins are executed in a single pass, and most joins can be done without even using a temporary table. Most temporary tables are memory-based hash tables. Temporary tables with a large row length (calculated as the sum of all column lengths) or that contain  BLOB  columns are stored on disk. 1836 •The MySQL Performance Schema is a feature for monitoring MySQL server execution at a low level. The Performance Schema dynamically allocates memory incrementally, scaling its memory use to actual server load, instead of allocating required memory during server startup. Once memory is allocated, it is not freed until the server is restarted. For more information, see Section 27.17, “The Performance Schema Memory-Allocation Model” . •Each thread that the server uses to manage client connections requires some thread-specific space. The following list indicates these and which system variables control their size: •A stack ( thread_stack ) •A connection buffer ( net_buffer_length ) •A result buffer ( net_buffer_length ) •If an internal in-memory temporary table becomes too large (as determined using the  tmp_table_size and  max_heap_table_size  system variables), MySQL automatically converts the table from in- memory to on-disk format. As of MySQL 8.0.16, on-disk temporary tables always use the InnoDB storage engine. (Previously, the storage engine employed for this purpose was determined by the internal_tmp_disk_storage_engine  system variable, which is no longer supported.) You can increase the permissible temporary table size as described in Section 8.4.4, “Internal Temporary Table Use in MySQL” . •The  myisam_use_mmap  system variable can be set to 1 to enable memory-mapping for all  MyISAM tables.