Tuning Server Parameters
722
read_buffer_size 131072
read_only FALSE
read_rnd_buffer_size 262144
record_buffer 131072
relay_log_purge TRUE
relay_log_space_limit 0
slave_compressed_protocol FALSE
slave_net_timeout 3600
slave_transaction_retries 10
slow_launch_time 2
sort_buffer_size 2097144
sync-binlog 0
sync-frm TRUE
table_cache 64
table_lock_wait_timeout 50
thread_cache_size 0
thread_concurrency 10
thread_stack 262144
time_format (No default value)
tmp_table_size 33554432
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
updatable_views_with_limit 1
wait_timeout 28800
For a
mysqld
server that is currently running, you can see the current values of its system variables by
connecting to it and issuing this statement:
mysql>
SHOW VARIABLES;
You can also see some statistical and status indicators for a running server by issuing this statement:
mysql>
SHOW STATUS;
System variable and status information also can be obtained using
mysqladmin
:
shell>
mysqladmin variables
shell>
mysqladmin extended-status
For a full description of all system and status variables, see
Section 5.1.4, “Server System Variables”
,
and
Section 5.1.6, “Server Status Variables”
.
MySQL uses algorithms that are very scalable, so you can usually run with very little memory.
However, normally you get better performance by giving MySQL more memory.
When tuning a MySQL server, the two most important variables to configure are
key_buffer_size
[458]
and
table_cache
[498]
. You should first feel confident that you have these
set appropriately before trying to change any other variables.
The following examples indicate some typical variable values for different runtime configurations.
• If you have at least 256MB of memory and many tables and want maximum performance with a
moderate number of clients, you should use something like this:
shell>
mysqld_safe --key_buffer_size=64M --table_cache=256 \
--sort_buffer_size=4M --read_buffer_size=1M &
• If you have only 128MB of memory and only a few tables, but you still do a lot of sorting, you can use
something like this:
shell>
mysqld_safe --key_buffer_size=16M --sort_buffer_size=1M
If there are very many simultaneous connections, swapping problems may occur unless
mysqld
has
been configured to use very little memory for each connection.
mysqld
performs better if you have
enough memory for all connections.
• With little memory and lots of connections, use something like this:
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...