DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info) server-parameters

Info Catalog (mysql.info) system (mysql.info) optimizing-the-server (mysql.info) controlling-optimizer
 
 7.5.2 Tuning Server Parameters
 ------------------------------
 
 You can determine the default buffer sizes used by the `mysqld' server
 using this command:
 
      shell> mysqld --verbose --help
 
 This command produces a list of all `mysqld' options and configurable
 system variables. The output includes the default variable values and
 looks something like this:
 
      back_log                          50
      binlog_cache_size                 32768
      bulk_insert_buffer_size           8388608
      connect_timeout                   5
      date_format                       (No default value)
      datetime_format                   (No default value)
      default_week_format               0
      delayed_insert_limit              100
      delayed_insert_timeout            300
      delayed_queue_size                1000
      expire_logs_days                  0
      flush_time                        1800
      ft_max_word_len                   84
      ft_min_word_len                   4
      ft_query_expansion_limit          20
      ft_stopword_file                  (No default value)
      group_concat_max_len              1024
      innodb_additional_mem_pool_size   1048576
      innodb_autoextend_increment       8
      innodb_buffer_pool_awe_mem_mb     0
      innodb_buffer_pool_size           8388608
      innodb_concurrency_tickets        500
      innodb_file_io_threads            4
      innodb_force_recovery             0
      innodb_lock_wait_timeout          50
      innodb_log_buffer_size            1048576
      innodb_log_file_size              5242880
      innodb_log_files_in_group         2
      innodb_mirrored_log_groups        1
      innodb_open_files                 300
      innodb_sync_spin_loops            20
      innodb_thread_concurrency         8
      innodb_thread_sleep_delay         10000
      interactive_timeout               28800
      join_buffer_size                  131072
      key_buffer_size                   8388600
      key_cache_age_threshold           300
      key_cache_block_size              1024
      key_cache_division_limit          100
      long_query_time                   10
      lower_case_table_names            1
      max_allowed_packet                1048576
      max_binlog_cache_size             4294967295
      max_binlog_size                   1073741824
      max_connect_errors                10
      max_connections                   100
      max_delayed_threads               20
      max_error_count                   64
      max_heap_table_size               16777216
      max_join_size                     4294967295
      max_length_for_sort_data          1024
      max_relay_log_size                0
      max_seeks_for_key                 4294967295
      max_sort_length                   1024
      max_tmp_tables                    32
      max_user_connections              0
      max_write_lock_count              4294967295
      multi_range_count                 256
      myisam_block_size                 1024
      myisam_data_pointer_size          6
      myisam_max_extra_sort_file_size   2147483648
      myisam_max_sort_file_size         2147483647
      myisam_repair_threads             1
      myisam_sort_buffer_size           8388608
      net_buffer_length                 16384
      net_read_timeout                  30
      net_retry_count                   10
      net_write_timeout                 60
      open_files_limit                  0
      optimizer_prune_level             1
      optimizer_search_depth            62
      preload_buffer_size               32768
      query_alloc_block_size            8192
      query_cache_limit                 1048576
      query_cache_min_res_unit          4096
      query_cache_size                  0
      query_cache_type                  1
      query_cache_wlock_invalidate      FALSE
      query_prealloc_size               8192
      range_alloc_block_size            2048
      read_buffer_size                  131072
      read_only                         FALSE
      read_rnd_buffer_size              262144
      div_precision_increment           4
      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
      sync-replication                  0
      sync-replication-slave-id         0
      sync-replication-timeout          10
      table_cache                       64
      thread_cache_size                 0
      thread_concurrency                10
      thread_stack                      196608
      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
 
 If there is a `mysqld' server 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 for all system and status variables, see 
 server-system-variables, and  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' and `table_cache'. 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:
 
           shell> mysqld_safe --key_buffer_size=512K --sort_buffer_size=100K \
                      --read_buffer_size=100K &
 
      Or even this:
 
           shell> mysqld_safe --key_buffer_size=512K --sort_buffer_size=16K \
                      --table_cache=32 --read_buffer_size=8K \
                      --net_buffer_length=1K &
 
 If you are performing `GROUP BY' or `ORDER BY' operations on tables
 that are much larger than your available memory, you should increase
 the value of `read_rnd_buffer_size' to speed up the reading of rows
 following sorting operations.
 
 When you have installed MySQL, the `support-files' directory contains
 some different `my.cnf' sample files: `my-huge.cnf', `my-large.cnf',
 `my-medium.cnf', and `my-small.cnf'. You can use these as a basis for
 optimizing your system. (On Windows, look in the MySQL installation
 directory.)
 
 If you specify an option on the command line for `mysqld' or
 `mysqld_safe', it remains in effect only for that invocation of the
 server. To use the option every time the server runs, put it in an
 option file.
 
 To see the effects of a parameter change, do something like this:
 
      shell> mysqld --key_buffer_size=32M --verbose --help
 
 The variable values are listed near the end of the output. Make sure
 that the -verbose and -help options are last. Otherwise, the effect of
 any options listed after them on the command line are not reflected in
 the output.
 
 For information on tuning the `InnoDB' storage engine, see 
 innodb-tuning.
 
Info Catalog (mysql.info) system (mysql.info) optimizing-the-server (mysql.info) controlling-optimizer
automatically generated byinfo2html