connection threads to be cached.
while the server runs. A connection thread becomes inactive when the client connection with which it
was associated terminates.
To monitor the number of threads in the cache and how many threads have been created
because a thread could not be taken from the cache, monitor the
Threads_created
You can set
of clients that can connect simultaneously.
When the thread stack is too small, this limits the complexity of the SQL statements which the server
can handle, the recursion depth of stored procedures, and other memory-consuming actions. To set a
stack size of
8.9.4. How MySQL Uses Memory
The following list indicates some of the ways that the
the name of the system variable relevant to the memory use is given:
• All threads share the
variable. Other buffers used by the server are allocated as needed. See
Server
Parameters".
• Each thread that is used to manage client connections uses some thread-specific space. The
following list indicates these and which variables control their size:
• A stack (variable
• A connection buffer (variable
• A result buffer (variable
The connection buffer and result buffer each begin with a size equal to
bytes, but are dynamically enlarged up to
buffer shrinks to
running, a copy of the current statement string is also allocated.
• 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.
• Only compressed
of 4GB is not large enough for most big tables. When systems with a 64-bit address space become
more common, we may add general support for memory mapping.
• Each request that performs a sequential scan of a table allocates a read buffer (variable
read_buffer_size
• When reading rows in an arbitrary sequence (for example, following a sort), a random-read buffer
(variable
• 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
If an internal in-memory temporary table becomes too large, MySQL handles this automatically by
changing the table from in-memory to on-disk format, to be handled by the
You can increase the permissible temporary table size as described in
Uses Internal Temporary
How MySQL Uses Memory
thread_cache_size
[534]
status variables.
[467]
max_connections
bytes for each thread, start the server with
N
key buffer; its size is determined by the
MyISAM
thread_stack
net_buffer_length
net_buffer_length
net_buffer_length
tables are memory mapped. This is because the 32-bit memory space
MyISAM
[488]).
read_rnd_buffer_size
Tables".
[499]
at server startup or at runtime to control the maximum number
--thread_stack=N
mysqld
[500])
[477])
[477])
max_allowed_packet
[477]
bytes after each SQL statement. While a statement is
[489]) may be allocated to avoid disk seeks.
724
can be set at server startup or changed
Threads_cached
[500].
server uses memory. Where applicable,
key_buffer_size
Section 8.9.2, "Tuning
net_buffer_length
[466]
bytes as needed. The result
columns are stored on disk.
BLOB
MyISAM
Section 8.8.5, "How MySQL
[534]
and
[458]
[477]
storage engine.
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers