SlideShare a Scribd company logo
1 of 185
Download to read offline
MySQL Performance
    Tuning 101
        Ligaya Turmelle
   MySQL Support Engineer
      ligaya@mysql.com




             1
MySQL
world's most popular open source database
software

a key part of LAMP (Linux, Apache, MySQL,
PHP / Perl / Python)

Site: http://www.mysql.com/

Download: http://dev.mysql.com/downloads/

Online Manual: http://dev.mysql.com/doc/
refman/5.1/en/index.html

                    2
Before you start




       3
Before you start

Single greatest gain can be received by
optimizing the queries.




                    3
Before you start

Single greatest gain can be received by
optimizing the queries.
Optimize the underlying system




                    3
Before you start

Single greatest gain can be received by
optimizing the queries.
Optimize the underlying system
Understand there are no hard/fast/exact
answers for values.




                   3
Before you start

Single greatest gain can be received by
optimizing the queries.
Optimize the underlying system
Understand there are no hard/fast/exact
answers for values.
   Change one value at a time and
   benchmark to look for improvement




                   3
Before you start

Single greatest gain can be received by
optimizing the queries.
Optimize the underlying system
Understand there are no hard/fast/exact
answers for values.
   Change one value at a time and
   benchmark to look for improvement
   Better to under allocate then over
   allocate values

                   3
How we use memory




        4
How we use memory

2 Ways - Global and per Connection




                   4
How we use memory

2 Ways - Global and per Connection

Global - Most allocated once when the
server starts - can be large




                   4
How we use memory

2 Ways - Global and per Connection

Global - Most allocated once when the
server starts - can be large

Per Connection - for each connection as
needed - should be small




                   4
How we use memory

2 Ways - Global and per Connection

Global - Most allocated once when the
server starts - can be large

Per Connection - for each connection as
needed - should be small

Global memory + (max_connections * session
buffers)

                    4
Information




     5
Information
Current Settings




                   5
Information
Current Settings

  mysql> SHOW GLOBAL VARIABLES;




                   5
Information
Current Settings

  mysql> SHOW GLOBAL VARIABLES;

  Shows the majority of the settings
  +----------------------------------------------------------------------------------------------------------------------------+

 |Variable_name                    | Value
  +-----------------------------------------------------------------------------------------------+
 | auto_increment_increment         | 1
 | auto_increment_offset            | 1
 | automatic_sp_privileges          | ON
 | back_log                        | 50
 | basedir                         | /Users/ligaya/mysql_installs/mysql-enterprise-gpl-5.0.50sp1-osx10.5-x86/
 | binlog_cache_size               | 32768
 | bulk_insert_buffer_size         | 8388608
 | character_set_client             | latin1




                                                                     5
Information
Current Settings

  mysql> SHOW GLOBAL VARIABLES;

  Shows the majority of the settings
  +----------------------------------------------------------------------------------------------------------------------------+

 |Variable_name                    | Value
  +-----------------------------------------------------------------------------------------------+
 | auto_increment_increment         | 1
 | auto_increment_offset            | 1
 | automatic_sp_privileges          | ON
 | back_log                        | 50
 | basedir                         | /Users/ligaya/mysql_installs/mysql-enterprise-gpl-5.0.50sp1-osx10.5-x86/
 | binlog_cache_size               | 32768
 | bulk_insert_buffer_size         | 8388608
 | character_set_client             | latin1


  my.cnf/my.ini

                                                                     5
Other Information




        6
Other Information

How much RAM on the machine?




                  6
Other Information

How much RAM on the machine?

Is the machine dedicated to MySQL?




                   6
Other Information

How much RAM on the machine?

Is the machine dedicated to MySQL?

64 bit processor?




                    6
Other Information

How much RAM on the machine?

Is the machine dedicated to MySQL?

64 bit processor?

64 bit MySQL server binary?




                    6
Server Status




      7
Server Status

mysql> SHOW GLOBAL STATUS;




                7
Server Status

mysql> SHOW GLOBAL STATUS;

has various counters




                   7
Server Status

mysql> SHOW GLOBAL STATUS;

has various counters

gives you a feel of what the server is
actually doing - not what you *think* it is
doing




                    7
Server Status

mysql> SHOW GLOBAL STATUS;

has various counters

gives you a feel of what the server is
actually doing - not what you *think* it is
doing

issue command twice with time between to
get the changes of values over time

                    7
Example Status
   +-----------------------------------+-------------+
| Variable_name                    | Value        |
+-----------------------------------+-------------+
| Aborted_clients                  | 6618         |
| Aborted_connects                 | 3957         |
| Binlog_cache_disk_use            | 0            |
| Binlog_cache_use                 | 0            |
| Bytes_received                   | 1320510015   |
| Bytes_sent                       | 2978960756   |
| Com_admin_commands               | 32124        |
....
| Threads_cached                   | 0            |
| Threads_connected                | 1            |
| Threads_created                  | 316771       |
| Threads_running                  | 1            |
| Uptime                           | 1722523      |
| Uptime_since_flush_status        | 1722523      |
+-----------------------------------+-------------+




                                         8
Finding the delta




        9
Finding the delta
Uptime - part of status information and is
given in seconds




                    9
Finding the delta
Uptime - part of status information and is
given in seconds
  Ex: 1086122 seconds = ~19.9 days = 478.5 hrs




                         9
Finding the delta
Uptime - part of status information and is
given in seconds
  Ex: 1086122 seconds = ~19.9 days = 478.5 hrs

helps you calculate the values in a given time
frame (high load, average load).




                         9
Finding the delta
Uptime - part of status information and is
given in seconds
  Ex: 1086122 seconds = ~19.9 days = 478.5 hrs

helps you calculate the values in a given time
frame (high load, average load).
  Ex: (bytes received[2] – bytes received[1])/ (Uptime[2] –
  Uptime[1])




                          9
Finding the delta
Uptime - part of status information and is
given in seconds
  Ex: 1086122 seconds = ~19.9 days = 478.5 hrs

helps you calculate the values in a given time
frame (high load, average load).
  Ex: (bytes received[2] – bytes received[1])/ (Uptime[2] –
  Uptime[1])
  (1320582719 - 1320510015 )/(1722729 - 1722523) =



                          9
Finding the delta
Uptime - part of status information and is
given in seconds
  Ex: 1086122 seconds = ~19.9 days = 478.5 hrs

helps you calculate the values in a given time
frame (high load, average load).
  Ex: (bytes received[2] – bytes received[1])/ (Uptime[2] –
  Uptime[1])
  (1320582719 - 1320510015 )/(1722729 - 1722523) =
      72704 bytes/ 206 sec = 352.9 bytes/sec


                          9
What is the server
      doing?




        10
What is the server
       doing?
Com_XXXX




           10
What is the server
       doing?
Com_XXXX

 Counter of the number of times XXXX
 has been executed




                10
What is the server
       doing?
Com_XXXX

 Counter of the number of times XXXX
 has been executed

 One status variable for each statement
 |   Com_delete          |   78813    |
 |   Com_insert          |   100357   |
 |   Com_replace         |   3130     |
 |   Com_select          |   984292   |
 |   Com_show_tables     |   459      |
 |   Com_show_triggers   |   898      |
 |   Com_create_table    |   1349     |
 |   Com_update          |   285105   |




                                 10
What is the server
       doing?
Com_XXXX

 Counter of the number of times XXXX
 has been executed

 One status variable for each statement
 |   Com_delete          |   78813    |
 |   Com_insert          |   100357   |
 |   Com_replace         |   3130     |
 |   Com_select          |   984292   |
 |   Com_show_tables     |   459      |
 |   Com_show_triggers   |   898      |
 |   Com_create_table    |   1349     |
 |   Com_update          |   285105   |



 Used with Uptime to find insert/sec or
 delete/sec

                                 10
What is the server
  doing (con’t)?




        11
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)




                  11
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)

  Key_blocks_unused:




                   11
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)

  Key_blocks_unused:

    number of unused blocks




                    11
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)

  Key_blocks_unused:

    number of unused blocks
    key_buffer_size - Key_blocks_unused = amount
    in use




                    11
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)

  Key_blocks_unused:

    number of unused blocks
    key_buffer_size - Key_blocks_unused = amount
    in use
  Key_blocks_used:




                     11
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)

  Key_blocks_unused:

    number of unused blocks
    key_buffer_size - Key_blocks_unused = amount
    in use
  Key_blocks_used:
    a high-water mark that indicates the
    maximum number of blocks that have ever
    been in use at one time.

                     11
What is the server
  doing (con’t)?




        12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)




                  12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)
  Key_read_requests:




                       12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)
  Key_read_requests:
     number of requests to read a key block from
     the cache.




                     12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)
  Key_read_requests:
     number of requests to read a key block from
     the cache.
     a cache hit




                     12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)
  Key_read_requests:
     number of requests to read a key block from
     the cache.
     a cache hit
  Key_reads:




                     12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)
  Key_read_requests:
     number of requests to read a key block from
     the cache.
     a cache hit
  Key_reads:
     number of physical reads of a key block from
     disk.




                      12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)
  Key_read_requests:
     number of requests to read a key block from
     the cache.
     a cache hit
  Key_reads:
     number of physical reads of a key block from
     disk.
     a cache miss




                      12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)
  Key_read_requests:
     number of requests to read a key block from
     the cache.
     a cache hit
  Key_reads:
     number of physical reads of a key block from
     disk.
     a cache miss
     If large, key_buffer_size is probably too
     small.



                      12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)
  Key_read_requests:
     number of requests to read a key block from
     the cache.
     a cache hit
  Key_reads:
     number of physical reads of a key block from
     disk.
     a cache miss
     If large, key_buffer_size is probably too
     small.
  cache miss rate = Key_reads/
  Key_read_requests.

                      12
What is the server
   doing (con’t)?
Information on your key buffer (MyISAM)
  Key_read_requests:
     number of requests to read a key block from
     the cache.
     a cache hit
  Key_reads:
     number of physical reads of a key block from
     disk.
     a cache miss
     If large, key_buffer_size is probably too
     small.
  cache miss rate = Key_reads/
  Key_read_requests.
  Key buffer efficiency: 1 – cache miss rate
                      12
key_buffer_size




       13
key_buffer_size
Global variable




                  13
key_buffer_size
Global variable
the buffer used for MyISAM *index blocks*.




                  13
key_buffer_size
Global variable
the buffer used for MyISAM *index blocks*.
Index blocks are buffered and shared by all
threads.




                   13
key_buffer_size
Global variable
the buffer used for MyISAM *index blocks*.
Index blocks are buffered and shared by all
threads.
 The maximum allowable setting
   4GB on 32-bit platforms.
    after 5.0.52 on 64-bit systems - 4GB+




                   13
key_buffer_size
Global variable
the buffer used for MyISAM *index blocks*.
Index blocks are buffered and shared by all
threads.
 The maximum allowable setting
   4GB on 32-bit platforms.
    after 5.0.52 on 64-bit systems - 4GB+
dedicated machine -25% of total memory
is quite common.


                   13
key_buffer_size
Global variable
the buffer used for MyISAM *index blocks*.
Index blocks are buffered and shared by all
threads.
 The maximum allowable setting
   4GB on 32-bit platforms.
    after 5.0.52 on 64-bit systems - 4GB+
dedicated machine -25% of total memory
is quite common.
uses the OS file cache to cache the files

                   13
key_buffer_size
Global variable
the buffer used for MyISAM *index blocks*.
Index blocks are buffered and shared by all
threads.
 The maximum allowable setting
   4GB on 32-bit platforms.
    after 5.0.52 on 64-bit systems - 4GB+
dedicated machine -25% of total memory
is quite common.
uses the OS file cache to cache the files
too high == paging === bad
                   13
What is the server
  doing (con’t)?




        14
What is the server
   doing (con’t)?
Table_locks_immediate: # of table locks
granted immediately to MyISAM tables.




                  14
What is the server
   doing (con’t)?
Table_locks_immediate: # of table locks
granted immediately to MyISAM tables.

Table_locks_waited: # of times we had
to wait to get a table lock for MyISAM
tables




                  14
What is the server
   doing (con’t)?
Table_locks_immediate: # of table locks
granted immediately to MyISAM tables.

Table_locks_waited: # of times we had
to wait to get a table lock for MyISAM
tables
  If the value is high - you may want to
  consider changing storage engines.


                   14
What is the server
  doing (con’t)?




        15
What is the server
   doing (con’t)?
Innodb_*




           15
What is the server
   doing (con’t)?
Innodb_*
  Has various information about the InnoDB
  tablespace




                   15
What is the server
   doing (con’t)?
Innodb_*
  Has various information about the InnoDB
  tablespace
    Innodb_buffer_pool_pages_data: number of
    pages containing data (dirty or clean).




                    15
What is the server
   doing (con’t)?
Innodb_*
  Has various information about the InnoDB
  tablespace
    Innodb_buffer_pool_pages_data: number of
    pages containing data (dirty or clean).
    Innodb_buffer_pool_pages_free: number of
    free pages.




                    15
What is the server
   doing (con’t)?
Innodb_*
  Has various information about the InnoDB
  tablespace
    Innodb_buffer_pool_pages_data: number of
    pages containing data (dirty or clean).
    Innodb_buffer_pool_pages_free: number of
    free pages.
    Innodb_buffer_pool_pages_total: The total size
    of the buffer pool, in pages.




                     15
What is the server
   doing (con’t)?
Innodb_*
  Has various information about the InnoDB
  tablespace
    Innodb_buffer_pool_pages_data: number of
    pages containing data (dirty or clean).
    Innodb_buffer_pool_pages_free: number of
    free pages.
    Innodb_buffer_pool_pages_total: The total size
    of the buffer pool, in pages.
    Innodb_buffer_pool_wait_free: counts
    instances of waiting for pages to be flushed.
    Should be small value.
                     15
innodb_buffer_pool_size




           16
innodb_buffer_pool_size
 Global variable




                   16
innodb_buffer_pool_size
 Global variable
 size in bytes




                   16
innodb_buffer_pool_size
 Global variable
 size in bytes
 used to cache data and indexes of tables.
 (Clustered indexes - remember)




                    16
innodb_buffer_pool_size
 Global variable
 size in bytes
 used to cache data and indexes of tables.
 (Clustered indexes - remember)
 The larger you set this value, the less disk
 I/O is needed to access data in tables.




                     16
innodb_buffer_pool_size
 Global variable
 size in bytes
 used to cache data and indexes of tables.
 (Clustered indexes - remember)
 The larger you set this value, the less disk
 I/O is needed to access data in tables.
 On a dedicated database server - up to
 80% of the machine physical memory size.



                     16
innodb_buffer_pool_size
 Global variable
 size in bytes
 used to cache data and indexes of tables.
 (Clustered indexes - remember)
 The larger you set this value, the less disk
 I/O is needed to access data in tables.
 On a dedicated database server - up to
 80% of the machine physical memory size.
 Buffers everything itself.


                     16
innodb_buffer_pool_size
 Global variable
 size in bytes
 used to cache data and indexes of tables.
 (Clustered indexes - remember)
 The larger you set this value, the less disk
 I/O is needed to access data in tables.
 On a dedicated database server - up to
 80% of the machine physical memory size.
 Buffers everything itself.
 do not set it too large - might cause
 paging in the operating system.
                     16
innodb_log_file_size




         17
innodb_log_file_size
Global variable




                  17
innodb_log_file_size
Global variable
size in bytes of *each* log file in a log group.




                     17
innodb_log_file_size
Global variable
size in bytes of *each* log file in a log group.
Balancing act
   larger the value, the less checkpoint flush
   activity - less disk I/O
   larger the log files - longer the crash
   recovery time




                     17
innodb_log_file_size
Global variable
size in bytes of *each* log file in a log group.
Balancing act
   larger the value, the less checkpoint flush
   activity - less disk I/O
   larger the log files - longer the crash
   recovery time
Sensible values range: 1MB to 1/N-th of the
size of the buffer pool
   N is the number of log files in the group
   (innodb_log_files_in_group - usually 2).


                     17
innodb_log_file_size
Global variable
size in bytes of *each* log file in a log group.
Balancing act
   larger the value, the less checkpoint flush
   activity - less disk I/O
   larger the log files - longer the crash
   recovery time
Sensible values range: 1MB to 1/N-th of the
size of the buffer pool
   N is the number of log files in the group
   (innodb_log_files_in_group - usually 2).
combined size of log files must be less than
4GB
                     17
What is the server
  doing (con’t)?




        18
What is the server
   doing (con’t)?
Query Cache Information




                  18
What is the server
   doing (con’t)?
Query Cache Information

  Qcache_total_blocks: total number of blocks in
  the query cache.




                     18
What is the server
   doing (con’t)?
Query Cache Information

  Qcache_total_blocks: total number of blocks in
  the query cache.

  Qcache_free_blocks: number of free memory
  blocks. Can indicate a problem with fragmentation.




                      18
What is the server
   doing (con’t)?
Query Cache Information

  Qcache_total_blocks: total number of blocks in
  the query cache.

  Qcache_free_blocks: number of free memory
  blocks. Can indicate a problem with fragmentation.

  Qcache_hits: number of query cache hits.




                      18
What is the server
   doing (con’t)?
Query Cache Information

  Qcache_total_blocks: total number of blocks in
  the query cache.

  Qcache_free_blocks: number of free memory
  blocks. Can indicate a problem with fragmentation.

  Qcache_hits: number of query cache hits.

  Qcache_inserts: number of queries added to
  the query cache.

                      18
What is the server
   doing (con’t)
Query Cache (con’t)

  Qcache_not_cached: number of non-cached
  queries (not cacheable, or not cached due to the
  query_cache_type setting).

  Qcache_queries_in_cache: number of queries
  registered in the query cache.

  Qcache_lowmem_prunes: number of queries
  that were deleted from the query cache
  because of low memory.


                      19
What is the server
  doing (con’t)?




        20
What is the server
   doing (con’t)?
Turning the Query cache counters into information




                       20
What is the server
   doing (con’t)?
Turning the Query cache counters into information
One quick and easy way to determine if you benefit
from using the query cache – Query Cache Hit Rate
   QC Hit Rate = Qcache_hits/(Qcache_hits
   +Com_select)




                       20
What is the server
   doing (con’t)?
Turning the Query cache counters into information
One quick and easy way to determine if you benefit
from using the query cache – Query Cache Hit Rate
   QC Hit Rate = Qcache_hits/(Qcache_hits
   +Com_select)
Also check to see how often you are invalidating
the queries in the cache.
   Qcache_inserts vs Com_select
   Want Qcache_inserts << Com_select - bigger
   the difference, the better



                       20
What is the server
        doing (con’t)?
    Turning the Query cache counters into information
    One quick and easy way to determine if you benefit
    from using the query cache – Query Cache Hit Rate
        QC Hit Rate = Qcache_hits/(Qcache_hits
        +Com_select)
     Also check to see how often you are invalidating
     the queries in the cache.
        Qcache_inserts vs Com_select
        Want Qcache_inserts << Com_select - bigger
        the difference, the better
Note: keep in mind warming up the cache

                           20
query_cache_size




       21
query_cache_size

Global variable




                  21
query_cache_size

Global variable

The amount of memory allocated for caching
query results.




                  21
query_cache_size

Global variable

The amount of memory allocated for caching
query results.

default value is 0, which disables the
query cache.




                    21
query_cache_size

Global variable

The amount of memory allocated for caching
query results.

default value is 0, which disables the
query cache.
allowable values are multiples of 1024;
other values are rounded down to the
nearest multiple.

                    21
query_cache_type




       22
query_cache_type
Global variable but can be set at the session
level




                    22
query_cache_type
Global variable but can be set at the session
level
3 options




                    22
query_cache_type
Global variable but can be set at the session
level
3 options
   0 (Off) - Don't cache results in or retrieve
   results from the query cache.




                    22
query_cache_type
Global variable but can be set at the session
level
3 options
   0 (Off) - Don't cache results in or retrieve
   results from the query cache.
   1 (On) - Cache all cacheable query results
   except - SELECT SQL_NO_CACHE. Default




                    22
query_cache_type
Global variable but can be set at the session
level
3 options
   0 (Off) - Don't cache results in or retrieve
   results from the query cache.
   1 (On) - Cache all cacheable query results
   except - SELECT SQL_NO_CACHE. Default
   2 (Demand) - Cache results only for
   cacheable queries that begin with SELECT
   SQL_CACHE



                    22
query_cache_type
Global variable but can be set at the session
level
3 options
   0 (Off) - Don't cache results in or retrieve
   results from the query cache.
   1 (On) - Cache all cacheable query results
   except - SELECT SQL_NO_CACHE. Default
   2 (Demand) - Cache results only for
   cacheable queries that begin with SELECT
   SQL_CACHE
Note that the query_cache_size of memory
is allocated even if query_cache_type is set
to 0.
                    22
What is the server
  doing (con’t)?




        23
What is the server
   doing (con’t)?
Threads




          23
What is the server
   doing (con’t)?
Threads
  Threads_cached: # of threads in the thread
  cache.




                     23
What is the server
   doing (con’t)?
Threads
  Threads_cached: # of threads in the thread
  cache.
  Threads_connected: # of currently open
  connections.




                     23
What is the server
   doing (con’t)?
Threads
  Threads_cached: # of threads in the thread
  cache.
  Threads_connected: # of currently open
  connections.
  Threads_created: # of threads created to
  handle connections.




                     23
What is the server
   doing (con’t)?
Threads
  Threads_cached: # of threads in the thread
  cache.
  Threads_connected: # of currently open
  connections.
  Threads_created: # of threads created to
  handle connections.
     If Threads_created is “big”, you may want to
     increase the thread_cache_size value.




                      23
What is the server
   doing (con’t)?
Threads
  Threads_cached: # of threads in the thread
  cache.
  Threads_connected: # of currently open
  connections.
  Threads_created: # of threads created to
  handle connections.
     If Threads_created is “big”, you may want to
     increase the thread_cache_size value.
     thread cache miss rate = Threads_created/
     Connections.


                      23
thread_cache_size




        24
thread_cache_size
Global variable but it grows as needed.




                       24
thread_cache_size
Global variable but it grows as needed.
threads to be cached for reuse.




                       24
thread_cache_size
Global variable but it grows as needed.
threads to be cached for reuse.
   When a client disconnects, client's threads are
   put in the cache until it is full.




                        24
thread_cache_size
Global variable but it grows as needed.
threads to be cached for reuse.
   When a client disconnects, client's threads are
   put in the cache until it is full.
   Requests for threads are satisfied by reusing
   threads taken from the cache. Only when the
   cache is empty is a new thread created.




                        24
thread_cache_size
Global variable but it grows as needed.
threads to be cached for reuse.
   When a client disconnects, client's threads are
   put in the cache until it is full.
   Requests for threads are satisfied by reusing
   threads taken from the cache. Only when the
   cache is empty is a new thread created.
increase to improve performance if you have a lot of
new connections.




                       24
thread_cache_size
Global variable but it grows as needed.
threads to be cached for reuse.
   When a client disconnects, client's threads are
   put in the cache until it is full.
   Requests for threads are satisfied by reusing
   threads taken from the cache. Only when the
   cache is empty is a new thread created.
increase to improve performance if you have a lot of
new connections.
   May not provide a notable performance improvement if
   you have a good thread implementation.




                         24
thread_cache_size
Global variable but it grows as needed.
threads to be cached for reuse.
   When a client disconnects, client's threads are
   put in the cache until it is full.
   Requests for threads are satisfied by reusing
   threads taken from the cache. Only when the
   cache is empty is a new thread created.
increase to improve performance if you have a lot of
new connections.
   May not provide a notable performance improvement if
   you have a good thread implementation.
(100-((Threads_created / Connections)*100) = thread
cache efficiency


                         24
What is the server
  doing (con’t)?




        25
What is the server
   doing (con’t)?
General Information counters of importance




                   25
What is the server
   doing (con’t)?
General Information counters of importance
  Connections: # of connection attempts (successful or not)




                         25
What is the server
   doing (con’t)?
General Information counters of importance
  Connections: # of connection attempts (successful or not)
  Queries: # of statements executed including statements
  executed within stored programs. added 5.0.76.




                         25
What is the server
   doing (con’t)?
General Information counters of importance
  Connections: # of connection attempts (successful or not)
  Queries: # of statements executed including statements
  executed within stored programs. added 5.0.76.
  Questions: # of statements sent to the server by
  clients and executed by the server. As of 5.0.72




                         25
What is the server
   doing (con’t)?
General Information counters of importance
  Connections: # of connection attempts (successful or not)
  Queries: # of statements executed including statements
  executed within stored programs. added 5.0.76.
  Questions: # of statements sent to the server by
  clients and executed by the server. As of 5.0.72
  Slow_queries: # of queries that have taken more than
  long_query_time seconds.




                         25
What is the server
   doing (con’t)?
General Information counters of importance
  Connections: # of connection attempts (successful or not)
  Queries: # of statements executed including statements
  executed within stored programs. added 5.0.76.
  Questions: # of statements sent to the server by
  clients and executed by the server. As of 5.0.72
  Slow_queries: # of queries that have taken more than
  long_query_time seconds.
  Sort_merge_passes: # of merge passes that the sort
  algorithm has had to do.
      If large, consider increasing the value of the
      sort_buffer_size system variable.


                         25
Another Global Variable
     for Tweeking




           26
Another Global Variable
     for Tweeking
 table_cache:




                26
Another Global Variable
     for Tweeking
 table_cache:

   The number of open tables for all threads.




                       26
Another Global Variable
     for Tweeking
 table_cache:

   The number of open tables for all threads.

      Increasing this value increases the number
      of file descriptors that mysqld requires.




                       26
Another Global Variable
     for Tweeking
 table_cache:

   The number of open tables for all threads.

      Increasing this value increases the number
      of file descriptors that mysqld requires.

   If Opened_tables is constantly increasing and
   you don't do FLUSH TABLES often - then you
   should increase the value of the table_cache
   variable.




                       26
Another Global Variable
     for Tweeking
 table_cache:

   The number of open tables for all threads.

      Increasing this value increases the number
      of file descriptors that mysqld requires.

   If Opened_tables is constantly increasing and
   you don't do FLUSH TABLES often - then you
   should increase the value of the table_cache
   variable.

   Global variable that expands as needed


                       26
Per connection variables
 available for tweeking




           27
Per connection variables
 available for tweeking
 max_heap_table_size:




                  27
Per connection variables
 available for tweeking
 max_heap_table_size:
   sets the maximum size to which MEMORY tables
   are allowed to grow.




                     27
Per connection variables
 available for tweeking
 max_heap_table_size:
   sets the maximum size to which MEMORY tables
   are allowed to grow.
   Dynamic variable - can be set per session




                     27
Per connection variables
 available for tweeking
 max_heap_table_size:
   sets the maximum size to which MEMORY tables
   are allowed to grow.
   Dynamic variable - can be set per session
 tmp_table_size:




                     27
Per connection variables
 available for tweeking
 max_heap_table_size:
   sets the maximum size to which MEMORY tables
   are allowed to grow.
   Dynamic variable - can be set per session
 tmp_table_size:
   Dynamic variable - can be set per session




                       27
Per connection variables
 available for tweeking
 max_heap_table_size:
   sets the maximum size to which MEMORY tables
   are allowed to grow.
   Dynamic variable - can be set per session
 tmp_table_size:
   Dynamic variable - can be set per session
   maximum size of internal in-memory temporary
   tables.
      actual limit is determined as the smaller of
      max_heap_table_size and tmp_table_size.




                       27
Per connection variables
 available for tweeking
 max_heap_table_size:
   sets the maximum size to which MEMORY tables
   are allowed to grow.
   Dynamic variable - can be set per session
 tmp_table_size:
   Dynamic variable - can be set per session
   maximum size of internal in-memory temporary
   tables.
       actual limit is determined as the smaller of
       max_heap_table_size and tmp_table_size.
   If in-memory temporary table exceeds the limit
   - MySQL automatically converts it to an on-disk
   MyISAM table.

                       27
Per connection variables
 available for tweeking




           28
Per connection variables
 available for tweeking
 read_buffer_size:




                     28
Per connection variables
 available for tweeking
 read_buffer_size:
    Dynamic variable - can be set per session




                        28
Per connection variables
 available for tweeking
 read_buffer_size:
    Dynamic variable - can be set per session
    Each thread that does a sequential scan -
    allocates a buffer of this size (in bytes) for
    each *table* it scans.




                          28
Per connection variables
 available for tweeking
 read_buffer_size:
    Dynamic variable - can be set per session
    Each thread that does a sequential scan -
    allocates a buffer of this size (in bytes) for
    each *table* it scans.
    If you do many sequential scans, you might want
    to increase this value.




                        28
Per connection variables
 available for tweeking
 read_buffer_size:
    Dynamic variable - can be set per session
    Each thread that does a sequential scan -
    allocates a buffer of this size (in bytes) for
    each *table* it scans.
    If you do many sequential scans, you might want
    to increase this value.
    value of this variable should be a multiple of
    4KB.




                        28
Per connection variables
 available for tweeking
 read_buffer_size:
    Dynamic variable - can be set per session
    Each thread that does a sequential scan -
    allocates a buffer of this size (in bytes) for
    each *table* it scans.
    If you do many sequential scans, you might want
    to increase this value.
    value of this variable should be a multiple of
    4KB.
    maximum allowable setting is 2GB
        do not normally recommend having it higher
        then 8M.


                        28
Per connection variables
 available for tweeking




           29
Per connection variables
 available for tweeking
 read_rnd_buffer_size:




                  29
Per connection variables
 available for tweeking
 read_rnd_buffer_size:
   Dynamic variable - can be set per session




                    29
Per connection variables
 available for tweeking
 read_rnd_buffer_size:
   Dynamic variable - can be set per session
   for reading rows in sorted order following a
   key-sorting operation. designed to avoid
   disk seeks.




                    29
Per connection variables
 available for tweeking
 read_rnd_buffer_size:
   Dynamic variable - can be set per session
   for reading rows in sorted order following a
   key-sorting operation. designed to avoid
   disk seeks.
   a large value can improve ORDER BY
   performance.




                    29
Per connection variables
 available for tweeking
 read_rnd_buffer_size:
   Dynamic variable - can be set per session
   for reading rows in sorted order following a
   key-sorting operation. designed to avoid
   disk seeks.
   a large value can improve ORDER BY
   performance.
   maximum allowable setting is 2GB
      do not normally recommend having it
      higher then 8M.
                    29
Per connection variables
 available for tweeking




           30
Per connection variables
 available for tweeking

 sort_buffer_size:




                     30
Per connection variables
 available for tweeking

 sort_buffer_size:
   Dynamic variable - can be set per session




                     30
Per connection variables
 available for tweeking

 sort_buffer_size:
   Dynamic variable - can be set per session

   Each thread that needs to do a sort
   allocates a buffer of this size.




                     30
Per connection variables
 available for tweeking

 sort_buffer_size:
   Dynamic variable - can be set per session

   Each thread that needs to do a sort
   allocates a buffer of this size.
   Increase this value for faster ORDER BY
   or GROUP BY operations.


                     30
Per connection variables
 available for tweeking




           31
Per connection variables
 available for tweeking
 bulk_insert_buffer_size:




                   31
Per connection variables
 available for tweeking
 bulk_insert_buffer_size:
   Dynamic variable - can be set per session




                    31
Per connection variables
 available for tweeking
 bulk_insert_buffer_size:
   Dynamic variable - can be set per session
   Cache to make bulk inserts faster for
   INSERT ... SELECT, INSERT ... VALUES
   (...), (...), ..., and LOAD DATA INFILE
   when adding data to non-empty tables.




                    31
Per connection variables
 available for tweeking
 bulk_insert_buffer_size:
   Dynamic variable - can be set per session
   Cache to make bulk inserts faster for
   INSERT ... SELECT, INSERT ... VALUES
   (...), (...), ..., and LOAD DATA INFILE
   when adding data to non-empty tables.
   Limits the size of the cache tree in
   bytes per thread.


                    31
Per connection variables
 available for tweeking
 bulk_insert_buffer_size:
   Dynamic variable - can be set per session
   Cache to make bulk inserts faster for
   INSERT ... SELECT, INSERT ... VALUES
   (...), (...), ..., and LOAD DATA INFILE
   when adding data to non-empty tables.
   Limits the size of the cache tree in
   bytes per thread.
   Set to 0 disables the optimization used

                    31
Per connection variables
 available for tweeking




           32
Per connection variables
 available for tweeking
   join_buffer_size:




                   32
Per connection variables
 available for tweeking
   join_buffer_size:
      Dynamic variable - can be set per
      session




                    32
Per connection variables
 available for tweeking
   join_buffer_size:
      Dynamic variable - can be set per
      session
      Size of the buffer that is used for
      plain index scans, range index scans,
      and joins that do not use indexes -
      full table scans.




                     32
Per connection variables
 available for tweeking
   join_buffer_size:
      Dynamic variable - can be set per
      session
      Size of the buffer that is used for
      plain index scans, range index scans,
      and joins that do not use indexes -
      full table scans.
      The best way to get fast joins is to
      add indexes.


                     32
Per connection variables
 available for tweeking
   join_buffer_size:
      Dynamic variable - can be set per
      session
      Size of the buffer that is used for
      plain index scans, range index scans,
      and joins that do not use indexes -
      full table scans.
      The best way to get fast joins is to
      add indexes.
      Band Aid - don’t depend on it.

                     32
33
33
MySQL Performance
    Tuning 101
        Ligaya Turmelle
   MySQL Support Engineer
      ligaya@mysql.com




             34

More Related Content

What's hot

Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability Mydbops
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBMydbops
 
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyMySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyContinuent
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)M Malai
 
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...Olivier DASINI
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeOlivier DASINI
 
Designing enterprise drupal
Designing enterprise drupalDesigning enterprise drupal
Designing enterprise drupalJason Burnett
 
What's New in MySQL 5.7
What's New in MySQL 5.7What's New in MySQL 5.7
What's New in MySQL 5.7Olivier DASINI
 
MySQL 5.6 config 優化
MySQL 5.6 config 優化MySQL 5.6 config 優化
MySQL 5.6 config 優化Alexis Li
 
High performance and high availability proxies for MySQL
High performance and high availability proxies for MySQLHigh performance and high availability proxies for MySQL
High performance and high availability proxies for MySQLMydbops
 
How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraSveta Smirnova
 
MySQL Enterprise Backup (MEB)
MySQL Enterprise Backup (MEB)MySQL Enterprise Backup (MEB)
MySQL Enterprise Backup (MEB)Mydbops
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014Dave Stokes
 
MySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDBMySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDBMario Beck
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera ClusterAbdul Manaf
 
Discard inport exchange table & tablespace
Discard inport exchange table & tablespaceDiscard inport exchange table & tablespace
Discard inport exchange table & tablespaceMarco Tusa
 
My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2Morgan Tocker
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014Ryusuke Kajiyama
 

What's hot (20)

Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
My sql 5.6&MySQL Cluster 7.3
My sql 5.6&MySQL Cluster 7.3My sql 5.6&MySQL Cluster 7.3
My sql 5.6&MySQL Cluster 7.3
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
 
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyMySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
 
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtime
 
MySQL Cluster Basics
MySQL Cluster BasicsMySQL Cluster Basics
MySQL Cluster Basics
 
Designing enterprise drupal
Designing enterprise drupalDesigning enterprise drupal
Designing enterprise drupal
 
What's New in MySQL 5.7
What's New in MySQL 5.7What's New in MySQL 5.7
What's New in MySQL 5.7
 
MySQL 5.6 config 優化
MySQL 5.6 config 優化MySQL 5.6 config 優化
MySQL 5.6 config 優化
 
High performance and high availability proxies for MySQL
High performance and high availability proxies for MySQLHigh performance and high availability proxies for MySQL
High performance and high availability proxies for MySQL
 
How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with Galera
 
MySQL Enterprise Backup (MEB)
MySQL Enterprise Backup (MEB)MySQL Enterprise Backup (MEB)
MySQL Enterprise Backup (MEB)
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014
 
MySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDBMySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDB
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera Cluster
 
Discard inport exchange table & tablespace
Discard inport exchange table & tablespaceDiscard inport exchange table & tablespace
Discard inport exchange table & tablespace
 
My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
 

Viewers also liked

MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and EngineAbdul Manaf
 
MySQL Storage Engines
MySQL Storage EnginesMySQL Storage Engines
MySQL Storage EnginesKarthik .P.R
 
MariaDB: Connect Storage Engine
MariaDB: Connect Storage EngineMariaDB: Connect Storage Engine
MariaDB: Connect Storage EngineKangaroot
 
MySQL Storage Engines Landscape
MySQL Storage Engines LandscapeMySQL Storage Engines Landscape
MySQL Storage Engines LandscapeColin Charles
 
MySQL Server Settings Tuning
MySQL Server Settings TuningMySQL Server Settings Tuning
MySQL Server Settings Tuningguest5ca94b
 
浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook晓 周
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerFromDual GmbH
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMark Swarbrick
 
MySQL Performance Tuning
MySQL Performance TuningMySQL Performance Tuning
MySQL Performance TuningFromDual GmbH
 
Performance Tuning Best Practices
Performance Tuning Best PracticesPerformance Tuning Best Practices
Performance Tuning Best Practiceswebhostingguy
 
Webinar 2013 advanced_query_tuning
Webinar 2013 advanced_query_tuningWebinar 2013 advanced_query_tuning
Webinar 2013 advanced_query_tuning晓 周
 
Join-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQLJoin-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQLZendCon
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MYXPLAIN
 
MySQL查询优化浅析
MySQL查询优化浅析MySQL查询优化浅析
MySQL查询优化浅析frogd
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance TuningMark Swarbrick
 
MySQL Performance Tips & Best Practices
MySQL Performance Tips & Best PracticesMySQL Performance Tips & Best Practices
MySQL Performance Tips & Best PracticesIsaac Mosquera
 
Mysql Explain Explained
Mysql Explain ExplainedMysql Explain Explained
Mysql Explain ExplainedJeremy Coates
 
MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsOSSCube
 

Viewers also liked (20)

MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and Engine
 
MySQL Storage Engines
MySQL Storage EnginesMySQL Storage Engines
MySQL Storage Engines
 
MariaDB: Connect Storage Engine
MariaDB: Connect Storage EngineMariaDB: Connect Storage Engine
MariaDB: Connect Storage Engine
 
MySQL Storage Engines Landscape
MySQL Storage Engines LandscapeMySQL Storage Engines Landscape
MySQL Storage Engines Landscape
 
MySQL Server Settings Tuning
MySQL Server Settings TuningMySQL Server Settings Tuning
MySQL Server Settings Tuning
 
Performance Tuning
Performance TuningPerformance Tuning
Performance Tuning
 
浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für Entwickler
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
MySQL Performance Tuning
MySQL Performance TuningMySQL Performance Tuning
MySQL Performance Tuning
 
Performance Tuning Best Practices
Performance Tuning Best PracticesPerformance Tuning Best Practices
Performance Tuning Best Practices
 
Webinar 2013 advanced_query_tuning
Webinar 2013 advanced_query_tuningWebinar 2013 advanced_query_tuning
Webinar 2013 advanced_query_tuning
 
Join-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQLJoin-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQL
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6
 
MySQL查询优化浅析
MySQL查询优化浅析MySQL查询优化浅析
MySQL查询优化浅析
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
MySQL Performance Tips & Best Practices
MySQL Performance Tips & Best PracticesMySQL Performance Tips & Best Practices
MySQL Performance Tips & Best Practices
 
Mysql Explain Explained
Mysql Explain ExplainedMysql Explain Explained
Mysql Explain Explained
 
MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 Tips
 
How to Design Indexes, Really
How to Design Indexes, ReallyHow to Design Indexes, Really
How to Design Indexes, Really
 

Similar to Perf Tuning Short

Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schemaMark Leith
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf TuningHighLoad2009
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightDataStax Academy
 
Exploring mysql cluster 7.4
Exploring mysql cluster 7.4Exploring mysql cluster 7.4
Exploring mysql cluster 7.4Ivan Ma
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
Advanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisAdvanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisMYXPLAIN
 
Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07Ivan Ma
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
The MySQL SYS Schema
The MySQL SYS SchemaThe MySQL SYS Schema
The MySQL SYS SchemaMark Leith
 
MySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & TuneMySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & TuneMark Swarbrick
 
MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep diveMark Leith
 
Mysql 57-upcoming-changes
Mysql 57-upcoming-changesMysql 57-upcoming-changes
Mysql 57-upcoming-changesMorgan Tocker
 
16 MySQL Optimization #burningkeyboards
16 MySQL Optimization #burningkeyboards16 MySQL Optimization #burningkeyboards
16 MySQL Optimization #burningkeyboardsDenis Ristic
 
MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep diveMark Leith
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 MinutesSveta Smirnova
 
6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance TuningOracleMySQL
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 

Similar to Perf Tuning Short (20)

DPC Tutorial
DPC TutorialDPC Tutorial
DPC Tutorial
 
Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schema
 
Tek tutorial
Tek tutorialTek tutorial
Tek tutorial
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-Flight
 
Exploring mysql cluster 7.4
Exploring mysql cluster 7.4Exploring mysql cluster 7.4
Exploring mysql cluster 7.4
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
Advanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisAdvanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and Analysis
 
Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
The MySQL SYS Schema
The MySQL SYS SchemaThe MySQL SYS Schema
The MySQL SYS Schema
 
MySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & TuneMySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & Tune
 
MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep dive
 
Mysql 57-upcoming-changes
Mysql 57-upcoming-changesMysql 57-upcoming-changes
Mysql 57-upcoming-changes
 
16 MySQL Optimization #burningkeyboards
16 MySQL Optimization #burningkeyboards16 MySQL Optimization #burningkeyboards
16 MySQL Optimization #burningkeyboards
 
MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep dive
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 Minutes
 
6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 

More from Ligaya Turmelle (9)

Troubleshooting tldr
Troubleshooting tldrTroubleshooting tldr
Troubleshooting tldr
 
Rootconf admin101
Rootconf admin101Rootconf admin101
Rootconf admin101
 
Zend2016 dba tutorial
Zend2016 dba tutorialZend2016 dba tutorial
Zend2016 dba tutorial
 
Normalization
NormalizationNormalization
Normalization
 
Character sets
Character setsCharacter sets
Character sets
 
MySQL 5.1 Replication
MySQL 5.1 ReplicationMySQL 5.1 Replication
MySQL 5.1 Replication
 
MySQL 5.5
MySQL 5.5MySQL 5.5
MySQL 5.5
 
Php Community
Php CommunityPhp Community
Php Community
 
Explain
ExplainExplain
Explain
 

Recently uploaded

Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataSafe Software
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServiceRenan Moreira de Oliveira
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncObject Automation
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum ComputingGDSC PJATK
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 

Recently uploaded (20)

Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation Inc
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum Computing
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 

Perf Tuning Short

  • 1. MySQL Performance Tuning 101 Ligaya Turmelle MySQL Support Engineer ligaya@mysql.com 1
  • 2. MySQL world's most popular open source database software a key part of LAMP (Linux, Apache, MySQL, PHP / Perl / Python) Site: http://www.mysql.com/ Download: http://dev.mysql.com/downloads/ Online Manual: http://dev.mysql.com/doc/ refman/5.1/en/index.html 2
  • 4. Before you start Single greatest gain can be received by optimizing the queries. 3
  • 5. Before you start Single greatest gain can be received by optimizing the queries. Optimize the underlying system 3
  • 6. Before you start Single greatest gain can be received by optimizing the queries. Optimize the underlying system Understand there are no hard/fast/exact answers for values. 3
  • 7. Before you start Single greatest gain can be received by optimizing the queries. Optimize the underlying system Understand there are no hard/fast/exact answers for values. Change one value at a time and benchmark to look for improvement 3
  • 8. Before you start Single greatest gain can be received by optimizing the queries. Optimize the underlying system Understand there are no hard/fast/exact answers for values. Change one value at a time and benchmark to look for improvement Better to under allocate then over allocate values 3
  • 9. How we use memory 4
  • 10. How we use memory 2 Ways - Global and per Connection 4
  • 11. How we use memory 2 Ways - Global and per Connection Global - Most allocated once when the server starts - can be large 4
  • 12. How we use memory 2 Ways - Global and per Connection Global - Most allocated once when the server starts - can be large Per Connection - for each connection as needed - should be small 4
  • 13. How we use memory 2 Ways - Global and per Connection Global - Most allocated once when the server starts - can be large Per Connection - for each connection as needed - should be small Global memory + (max_connections * session buffers) 4
  • 16. Information Current Settings mysql> SHOW GLOBAL VARIABLES; 5
  • 17. Information Current Settings mysql> SHOW GLOBAL VARIABLES; Shows the majority of the settings +----------------------------------------------------------------------------------------------------------------------------+ |Variable_name | Value +-----------------------------------------------------------------------------------------------+ | auto_increment_increment | 1 | auto_increment_offset | 1 | automatic_sp_privileges | ON | back_log | 50 | basedir | /Users/ligaya/mysql_installs/mysql-enterprise-gpl-5.0.50sp1-osx10.5-x86/ | binlog_cache_size | 32768 | bulk_insert_buffer_size | 8388608 | character_set_client | latin1 5
  • 18. Information Current Settings mysql> SHOW GLOBAL VARIABLES; Shows the majority of the settings +----------------------------------------------------------------------------------------------------------------------------+ |Variable_name | Value +-----------------------------------------------------------------------------------------------+ | auto_increment_increment | 1 | auto_increment_offset | 1 | automatic_sp_privileges | ON | back_log | 50 | basedir | /Users/ligaya/mysql_installs/mysql-enterprise-gpl-5.0.50sp1-osx10.5-x86/ | binlog_cache_size | 32768 | bulk_insert_buffer_size | 8388608 | character_set_client | latin1 my.cnf/my.ini 5
  • 20. Other Information How much RAM on the machine? 6
  • 21. Other Information How much RAM on the machine? Is the machine dedicated to MySQL? 6
  • 22. Other Information How much RAM on the machine? Is the machine dedicated to MySQL? 64 bit processor? 6
  • 23. Other Information How much RAM on the machine? Is the machine dedicated to MySQL? 64 bit processor? 64 bit MySQL server binary? 6
  • 25. Server Status mysql> SHOW GLOBAL STATUS; 7
  • 26. Server Status mysql> SHOW GLOBAL STATUS; has various counters 7
  • 27. Server Status mysql> SHOW GLOBAL STATUS; has various counters gives you a feel of what the server is actually doing - not what you *think* it is doing 7
  • 28. Server Status mysql> SHOW GLOBAL STATUS; has various counters gives you a feel of what the server is actually doing - not what you *think* it is doing issue command twice with time between to get the changes of values over time 7
  • 29. Example Status +-----------------------------------+-------------+ | Variable_name | Value | +-----------------------------------+-------------+ | Aborted_clients | 6618 | | Aborted_connects | 3957 | | Binlog_cache_disk_use | 0 | | Binlog_cache_use | 0 | | Bytes_received | 1320510015 | | Bytes_sent | 2978960756 | | Com_admin_commands | 32124 | .... | Threads_cached | 0 | | Threads_connected | 1 | | Threads_created | 316771 | | Threads_running | 1 | | Uptime | 1722523 | | Uptime_since_flush_status | 1722523 | +-----------------------------------+-------------+ 8
  • 31. Finding the delta Uptime - part of status information and is given in seconds 9
  • 32. Finding the delta Uptime - part of status information and is given in seconds Ex: 1086122 seconds = ~19.9 days = 478.5 hrs 9
  • 33. Finding the delta Uptime - part of status information and is given in seconds Ex: 1086122 seconds = ~19.9 days = 478.5 hrs helps you calculate the values in a given time frame (high load, average load). 9
  • 34. Finding the delta Uptime - part of status information and is given in seconds Ex: 1086122 seconds = ~19.9 days = 478.5 hrs helps you calculate the values in a given time frame (high load, average load). Ex: (bytes received[2] – bytes received[1])/ (Uptime[2] – Uptime[1]) 9
  • 35. Finding the delta Uptime - part of status information and is given in seconds Ex: 1086122 seconds = ~19.9 days = 478.5 hrs helps you calculate the values in a given time frame (high load, average load). Ex: (bytes received[2] – bytes received[1])/ (Uptime[2] – Uptime[1]) (1320582719 - 1320510015 )/(1722729 - 1722523) = 9
  • 36. Finding the delta Uptime - part of status information and is given in seconds Ex: 1086122 seconds = ~19.9 days = 478.5 hrs helps you calculate the values in a given time frame (high load, average load). Ex: (bytes received[2] – bytes received[1])/ (Uptime[2] – Uptime[1]) (1320582719 - 1320510015 )/(1722729 - 1722523) = 72704 bytes/ 206 sec = 352.9 bytes/sec 9
  • 37. What is the server doing? 10
  • 38. What is the server doing? Com_XXXX 10
  • 39. What is the server doing? Com_XXXX Counter of the number of times XXXX has been executed 10
  • 40. What is the server doing? Com_XXXX Counter of the number of times XXXX has been executed One status variable for each statement | Com_delete | 78813 | | Com_insert | 100357 | | Com_replace | 3130 | | Com_select | 984292 | | Com_show_tables | 459 | | Com_show_triggers | 898 | | Com_create_table | 1349 | | Com_update | 285105 | 10
  • 41. What is the server doing? Com_XXXX Counter of the number of times XXXX has been executed One status variable for each statement | Com_delete | 78813 | | Com_insert | 100357 | | Com_replace | 3130 | | Com_select | 984292 | | Com_show_tables | 459 | | Com_show_triggers | 898 | | Com_create_table | 1349 | | Com_update | 285105 | Used with Uptime to find insert/sec or delete/sec 10
  • 42. What is the server doing (con’t)? 11
  • 43. What is the server doing (con’t)? Information on your key buffer (MyISAM) 11
  • 44. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_blocks_unused: 11
  • 45. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_blocks_unused: number of unused blocks 11
  • 46. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_blocks_unused: number of unused blocks key_buffer_size - Key_blocks_unused = amount in use 11
  • 47. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_blocks_unused: number of unused blocks key_buffer_size - Key_blocks_unused = amount in use Key_blocks_used: 11
  • 48. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_blocks_unused: number of unused blocks key_buffer_size - Key_blocks_unused = amount in use Key_blocks_used: a high-water mark that indicates the maximum number of blocks that have ever been in use at one time. 11
  • 49. What is the server doing (con’t)? 12
  • 50. What is the server doing (con’t)? Information on your key buffer (MyISAM) 12
  • 51. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_read_requests: 12
  • 52. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_read_requests: number of requests to read a key block from the cache. 12
  • 53. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_read_requests: number of requests to read a key block from the cache. a cache hit 12
  • 54. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_read_requests: number of requests to read a key block from the cache. a cache hit Key_reads: 12
  • 55. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_read_requests: number of requests to read a key block from the cache. a cache hit Key_reads: number of physical reads of a key block from disk. 12
  • 56. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_read_requests: number of requests to read a key block from the cache. a cache hit Key_reads: number of physical reads of a key block from disk. a cache miss 12
  • 57. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_read_requests: number of requests to read a key block from the cache. a cache hit Key_reads: number of physical reads of a key block from disk. a cache miss If large, key_buffer_size is probably too small. 12
  • 58. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_read_requests: number of requests to read a key block from the cache. a cache hit Key_reads: number of physical reads of a key block from disk. a cache miss If large, key_buffer_size is probably too small. cache miss rate = Key_reads/ Key_read_requests. 12
  • 59. What is the server doing (con’t)? Information on your key buffer (MyISAM) Key_read_requests: number of requests to read a key block from the cache. a cache hit Key_reads: number of physical reads of a key block from disk. a cache miss If large, key_buffer_size is probably too small. cache miss rate = Key_reads/ Key_read_requests. Key buffer efficiency: 1 – cache miss rate 12
  • 62. key_buffer_size Global variable the buffer used for MyISAM *index blocks*. 13
  • 63. key_buffer_size Global variable the buffer used for MyISAM *index blocks*. Index blocks are buffered and shared by all threads. 13
  • 64. key_buffer_size Global variable the buffer used for MyISAM *index blocks*. Index blocks are buffered and shared by all threads. The maximum allowable setting 4GB on 32-bit platforms. after 5.0.52 on 64-bit systems - 4GB+ 13
  • 65. key_buffer_size Global variable the buffer used for MyISAM *index blocks*. Index blocks are buffered and shared by all threads. The maximum allowable setting 4GB on 32-bit platforms. after 5.0.52 on 64-bit systems - 4GB+ dedicated machine -25% of total memory is quite common. 13
  • 66. key_buffer_size Global variable the buffer used for MyISAM *index blocks*. Index blocks are buffered and shared by all threads. The maximum allowable setting 4GB on 32-bit platforms. after 5.0.52 on 64-bit systems - 4GB+ dedicated machine -25% of total memory is quite common. uses the OS file cache to cache the files 13
  • 67. key_buffer_size Global variable the buffer used for MyISAM *index blocks*. Index blocks are buffered and shared by all threads. The maximum allowable setting 4GB on 32-bit platforms. after 5.0.52 on 64-bit systems - 4GB+ dedicated machine -25% of total memory is quite common. uses the OS file cache to cache the files too high == paging === bad 13
  • 68. What is the server doing (con’t)? 14
  • 69. What is the server doing (con’t)? Table_locks_immediate: # of table locks granted immediately to MyISAM tables. 14
  • 70. What is the server doing (con’t)? Table_locks_immediate: # of table locks granted immediately to MyISAM tables. Table_locks_waited: # of times we had to wait to get a table lock for MyISAM tables 14
  • 71. What is the server doing (con’t)? Table_locks_immediate: # of table locks granted immediately to MyISAM tables. Table_locks_waited: # of times we had to wait to get a table lock for MyISAM tables If the value is high - you may want to consider changing storage engines. 14
  • 72. What is the server doing (con’t)? 15
  • 73. What is the server doing (con’t)? Innodb_* 15
  • 74. What is the server doing (con’t)? Innodb_* Has various information about the InnoDB tablespace 15
  • 75. What is the server doing (con’t)? Innodb_* Has various information about the InnoDB tablespace Innodb_buffer_pool_pages_data: number of pages containing data (dirty or clean). 15
  • 76. What is the server doing (con’t)? Innodb_* Has various information about the InnoDB tablespace Innodb_buffer_pool_pages_data: number of pages containing data (dirty or clean). Innodb_buffer_pool_pages_free: number of free pages. 15
  • 77. What is the server doing (con’t)? Innodb_* Has various information about the InnoDB tablespace Innodb_buffer_pool_pages_data: number of pages containing data (dirty or clean). Innodb_buffer_pool_pages_free: number of free pages. Innodb_buffer_pool_pages_total: The total size of the buffer pool, in pages. 15
  • 78. What is the server doing (con’t)? Innodb_* Has various information about the InnoDB tablespace Innodb_buffer_pool_pages_data: number of pages containing data (dirty or clean). Innodb_buffer_pool_pages_free: number of free pages. Innodb_buffer_pool_pages_total: The total size of the buffer pool, in pages. Innodb_buffer_pool_wait_free: counts instances of waiting for pages to be flushed. Should be small value. 15
  • 82. innodb_buffer_pool_size Global variable size in bytes used to cache data and indexes of tables. (Clustered indexes - remember) 16
  • 83. innodb_buffer_pool_size Global variable size in bytes used to cache data and indexes of tables. (Clustered indexes - remember) The larger you set this value, the less disk I/O is needed to access data in tables. 16
  • 84. innodb_buffer_pool_size Global variable size in bytes used to cache data and indexes of tables. (Clustered indexes - remember) The larger you set this value, the less disk I/O is needed to access data in tables. On a dedicated database server - up to 80% of the machine physical memory size. 16
  • 85. innodb_buffer_pool_size Global variable size in bytes used to cache data and indexes of tables. (Clustered indexes - remember) The larger you set this value, the less disk I/O is needed to access data in tables. On a dedicated database server - up to 80% of the machine physical memory size. Buffers everything itself. 16
  • 86. innodb_buffer_pool_size Global variable size in bytes used to cache data and indexes of tables. (Clustered indexes - remember) The larger you set this value, the less disk I/O is needed to access data in tables. On a dedicated database server - up to 80% of the machine physical memory size. Buffers everything itself. do not set it too large - might cause paging in the operating system. 16
  • 89. innodb_log_file_size Global variable size in bytes of *each* log file in a log group. 17
  • 90. innodb_log_file_size Global variable size in bytes of *each* log file in a log group. Balancing act larger the value, the less checkpoint flush activity - less disk I/O larger the log files - longer the crash recovery time 17
  • 91. innodb_log_file_size Global variable size in bytes of *each* log file in a log group. Balancing act larger the value, the less checkpoint flush activity - less disk I/O larger the log files - longer the crash recovery time Sensible values range: 1MB to 1/N-th of the size of the buffer pool N is the number of log files in the group (innodb_log_files_in_group - usually 2). 17
  • 92. innodb_log_file_size Global variable size in bytes of *each* log file in a log group. Balancing act larger the value, the less checkpoint flush activity - less disk I/O larger the log files - longer the crash recovery time Sensible values range: 1MB to 1/N-th of the size of the buffer pool N is the number of log files in the group (innodb_log_files_in_group - usually 2). combined size of log files must be less than 4GB 17
  • 93. What is the server doing (con’t)? 18
  • 94. What is the server doing (con’t)? Query Cache Information 18
  • 95. What is the server doing (con’t)? Query Cache Information Qcache_total_blocks: total number of blocks in the query cache. 18
  • 96. What is the server doing (con’t)? Query Cache Information Qcache_total_blocks: total number of blocks in the query cache. Qcache_free_blocks: number of free memory blocks. Can indicate a problem with fragmentation. 18
  • 97. What is the server doing (con’t)? Query Cache Information Qcache_total_blocks: total number of blocks in the query cache. Qcache_free_blocks: number of free memory blocks. Can indicate a problem with fragmentation. Qcache_hits: number of query cache hits. 18
  • 98. What is the server doing (con’t)? Query Cache Information Qcache_total_blocks: total number of blocks in the query cache. Qcache_free_blocks: number of free memory blocks. Can indicate a problem with fragmentation. Qcache_hits: number of query cache hits. Qcache_inserts: number of queries added to the query cache. 18
  • 99. What is the server doing (con’t) Query Cache (con’t) Qcache_not_cached: number of non-cached queries (not cacheable, or not cached due to the query_cache_type setting). Qcache_queries_in_cache: number of queries registered in the query cache. Qcache_lowmem_prunes: number of queries that were deleted from the query cache because of low memory. 19
  • 100. What is the server doing (con’t)? 20
  • 101. What is the server doing (con’t)? Turning the Query cache counters into information 20
  • 102. What is the server doing (con’t)? Turning the Query cache counters into information One quick and easy way to determine if you benefit from using the query cache – Query Cache Hit Rate QC Hit Rate = Qcache_hits/(Qcache_hits +Com_select) 20
  • 103. What is the server doing (con’t)? Turning the Query cache counters into information One quick and easy way to determine if you benefit from using the query cache – Query Cache Hit Rate QC Hit Rate = Qcache_hits/(Qcache_hits +Com_select) Also check to see how often you are invalidating the queries in the cache. Qcache_inserts vs Com_select Want Qcache_inserts << Com_select - bigger the difference, the better 20
  • 104. What is the server doing (con’t)? Turning the Query cache counters into information One quick and easy way to determine if you benefit from using the query cache – Query Cache Hit Rate QC Hit Rate = Qcache_hits/(Qcache_hits +Com_select) Also check to see how often you are invalidating the queries in the cache. Qcache_inserts vs Com_select Want Qcache_inserts << Com_select - bigger the difference, the better Note: keep in mind warming up the cache 20
  • 107. query_cache_size Global variable The amount of memory allocated for caching query results. 21
  • 108. query_cache_size Global variable The amount of memory allocated for caching query results. default value is 0, which disables the query cache. 21
  • 109. query_cache_size Global variable The amount of memory allocated for caching query results. default value is 0, which disables the query cache. allowable values are multiples of 1024; other values are rounded down to the nearest multiple. 21
  • 111. query_cache_type Global variable but can be set at the session level 22
  • 112. query_cache_type Global variable but can be set at the session level 3 options 22
  • 113. query_cache_type Global variable but can be set at the session level 3 options 0 (Off) - Don't cache results in or retrieve results from the query cache. 22
  • 114. query_cache_type Global variable but can be set at the session level 3 options 0 (Off) - Don't cache results in or retrieve results from the query cache. 1 (On) - Cache all cacheable query results except - SELECT SQL_NO_CACHE. Default 22
  • 115. query_cache_type Global variable but can be set at the session level 3 options 0 (Off) - Don't cache results in or retrieve results from the query cache. 1 (On) - Cache all cacheable query results except - SELECT SQL_NO_CACHE. Default 2 (Demand) - Cache results only for cacheable queries that begin with SELECT SQL_CACHE 22
  • 116. query_cache_type Global variable but can be set at the session level 3 options 0 (Off) - Don't cache results in or retrieve results from the query cache. 1 (On) - Cache all cacheable query results except - SELECT SQL_NO_CACHE. Default 2 (Demand) - Cache results only for cacheable queries that begin with SELECT SQL_CACHE Note that the query_cache_size of memory is allocated even if query_cache_type is set to 0. 22
  • 117. What is the server doing (con’t)? 23
  • 118. What is the server doing (con’t)? Threads 23
  • 119. What is the server doing (con’t)? Threads Threads_cached: # of threads in the thread cache. 23
  • 120. What is the server doing (con’t)? Threads Threads_cached: # of threads in the thread cache. Threads_connected: # of currently open connections. 23
  • 121. What is the server doing (con’t)? Threads Threads_cached: # of threads in the thread cache. Threads_connected: # of currently open connections. Threads_created: # of threads created to handle connections. 23
  • 122. What is the server doing (con’t)? Threads Threads_cached: # of threads in the thread cache. Threads_connected: # of currently open connections. Threads_created: # of threads created to handle connections. If Threads_created is “big”, you may want to increase the thread_cache_size value. 23
  • 123. What is the server doing (con’t)? Threads Threads_cached: # of threads in the thread cache. Threads_connected: # of currently open connections. Threads_created: # of threads created to handle connections. If Threads_created is “big”, you may want to increase the thread_cache_size value. thread cache miss rate = Threads_created/ Connections. 23
  • 125. thread_cache_size Global variable but it grows as needed. 24
  • 126. thread_cache_size Global variable but it grows as needed. threads to be cached for reuse. 24
  • 127. thread_cache_size Global variable but it grows as needed. threads to be cached for reuse. When a client disconnects, client's threads are put in the cache until it is full. 24
  • 128. thread_cache_size Global variable but it grows as needed. threads to be cached for reuse. When a client disconnects, client's threads are put in the cache until it is full. Requests for threads are satisfied by reusing threads taken from the cache. Only when the cache is empty is a new thread created. 24
  • 129. thread_cache_size Global variable but it grows as needed. threads to be cached for reuse. When a client disconnects, client's threads are put in the cache until it is full. Requests for threads are satisfied by reusing threads taken from the cache. Only when the cache is empty is a new thread created. increase to improve performance if you have a lot of new connections. 24
  • 130. thread_cache_size Global variable but it grows as needed. threads to be cached for reuse. When a client disconnects, client's threads are put in the cache until it is full. Requests for threads are satisfied by reusing threads taken from the cache. Only when the cache is empty is a new thread created. increase to improve performance if you have a lot of new connections. May not provide a notable performance improvement if you have a good thread implementation. 24
  • 131. thread_cache_size Global variable but it grows as needed. threads to be cached for reuse. When a client disconnects, client's threads are put in the cache until it is full. Requests for threads are satisfied by reusing threads taken from the cache. Only when the cache is empty is a new thread created. increase to improve performance if you have a lot of new connections. May not provide a notable performance improvement if you have a good thread implementation. (100-((Threads_created / Connections)*100) = thread cache efficiency 24
  • 132. What is the server doing (con’t)? 25
  • 133. What is the server doing (con’t)? General Information counters of importance 25
  • 134. What is the server doing (con’t)? General Information counters of importance Connections: # of connection attempts (successful or not) 25
  • 135. What is the server doing (con’t)? General Information counters of importance Connections: # of connection attempts (successful or not) Queries: # of statements executed including statements executed within stored programs. added 5.0.76. 25
  • 136. What is the server doing (con’t)? General Information counters of importance Connections: # of connection attempts (successful or not) Queries: # of statements executed including statements executed within stored programs. added 5.0.76. Questions: # of statements sent to the server by clients and executed by the server. As of 5.0.72 25
  • 137. What is the server doing (con’t)? General Information counters of importance Connections: # of connection attempts (successful or not) Queries: # of statements executed including statements executed within stored programs. added 5.0.76. Questions: # of statements sent to the server by clients and executed by the server. As of 5.0.72 Slow_queries: # of queries that have taken more than long_query_time seconds. 25
  • 138. What is the server doing (con’t)? General Information counters of importance Connections: # of connection attempts (successful or not) Queries: # of statements executed including statements executed within stored programs. added 5.0.76. Questions: # of statements sent to the server by clients and executed by the server. As of 5.0.72 Slow_queries: # of queries that have taken more than long_query_time seconds. Sort_merge_passes: # of merge passes that the sort algorithm has had to do. If large, consider increasing the value of the sort_buffer_size system variable. 25
  • 139. Another Global Variable for Tweeking 26
  • 140. Another Global Variable for Tweeking table_cache: 26
  • 141. Another Global Variable for Tweeking table_cache: The number of open tables for all threads. 26
  • 142. Another Global Variable for Tweeking table_cache: The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires. 26
  • 143. Another Global Variable for Tweeking table_cache: The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires. If Opened_tables is constantly increasing and you don't do FLUSH TABLES often - then you should increase the value of the table_cache variable. 26
  • 144. Another Global Variable for Tweeking table_cache: The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires. If Opened_tables is constantly increasing and you don't do FLUSH TABLES often - then you should increase the value of the table_cache variable. Global variable that expands as needed 26
  • 145. Per connection variables available for tweeking 27
  • 146. Per connection variables available for tweeking max_heap_table_size: 27
  • 147. Per connection variables available for tweeking max_heap_table_size: sets the maximum size to which MEMORY tables are allowed to grow. 27
  • 148. Per connection variables available for tweeking max_heap_table_size: sets the maximum size to which MEMORY tables are allowed to grow. Dynamic variable - can be set per session 27
  • 149. Per connection variables available for tweeking max_heap_table_size: sets the maximum size to which MEMORY tables are allowed to grow. Dynamic variable - can be set per session tmp_table_size: 27
  • 150. Per connection variables available for tweeking max_heap_table_size: sets the maximum size to which MEMORY tables are allowed to grow. Dynamic variable - can be set per session tmp_table_size: Dynamic variable - can be set per session 27
  • 151. Per connection variables available for tweeking max_heap_table_size: sets the maximum size to which MEMORY tables are allowed to grow. Dynamic variable - can be set per session tmp_table_size: Dynamic variable - can be set per session maximum size of internal in-memory temporary tables. actual limit is determined as the smaller of max_heap_table_size and tmp_table_size. 27
  • 152. Per connection variables available for tweeking max_heap_table_size: sets the maximum size to which MEMORY tables are allowed to grow. Dynamic variable - can be set per session tmp_table_size: Dynamic variable - can be set per session maximum size of internal in-memory temporary tables. actual limit is determined as the smaller of max_heap_table_size and tmp_table_size. If in-memory temporary table exceeds the limit - MySQL automatically converts it to an on-disk MyISAM table. 27
  • 153. Per connection variables available for tweeking 28
  • 154. Per connection variables available for tweeking read_buffer_size: 28
  • 155. Per connection variables available for tweeking read_buffer_size: Dynamic variable - can be set per session 28
  • 156. Per connection variables available for tweeking read_buffer_size: Dynamic variable - can be set per session Each thread that does a sequential scan - allocates a buffer of this size (in bytes) for each *table* it scans. 28
  • 157. Per connection variables available for tweeking read_buffer_size: Dynamic variable - can be set per session Each thread that does a sequential scan - allocates a buffer of this size (in bytes) for each *table* it scans. If you do many sequential scans, you might want to increase this value. 28
  • 158. Per connection variables available for tweeking read_buffer_size: Dynamic variable - can be set per session Each thread that does a sequential scan - allocates a buffer of this size (in bytes) for each *table* it scans. If you do many sequential scans, you might want to increase this value. value of this variable should be a multiple of 4KB. 28
  • 159. Per connection variables available for tweeking read_buffer_size: Dynamic variable - can be set per session Each thread that does a sequential scan - allocates a buffer of this size (in bytes) for each *table* it scans. If you do many sequential scans, you might want to increase this value. value of this variable should be a multiple of 4KB. maximum allowable setting is 2GB do not normally recommend having it higher then 8M. 28
  • 160. Per connection variables available for tweeking 29
  • 161. Per connection variables available for tweeking read_rnd_buffer_size: 29
  • 162. Per connection variables available for tweeking read_rnd_buffer_size: Dynamic variable - can be set per session 29
  • 163. Per connection variables available for tweeking read_rnd_buffer_size: Dynamic variable - can be set per session for reading rows in sorted order following a key-sorting operation. designed to avoid disk seeks. 29
  • 164. Per connection variables available for tweeking read_rnd_buffer_size: Dynamic variable - can be set per session for reading rows in sorted order following a key-sorting operation. designed to avoid disk seeks. a large value can improve ORDER BY performance. 29
  • 165. Per connection variables available for tweeking read_rnd_buffer_size: Dynamic variable - can be set per session for reading rows in sorted order following a key-sorting operation. designed to avoid disk seeks. a large value can improve ORDER BY performance. maximum allowable setting is 2GB do not normally recommend having it higher then 8M. 29
  • 166. Per connection variables available for tweeking 30
  • 167. Per connection variables available for tweeking sort_buffer_size: 30
  • 168. Per connection variables available for tweeking sort_buffer_size: Dynamic variable - can be set per session 30
  • 169. Per connection variables available for tweeking sort_buffer_size: Dynamic variable - can be set per session Each thread that needs to do a sort allocates a buffer of this size. 30
  • 170. Per connection variables available for tweeking sort_buffer_size: Dynamic variable - can be set per session Each thread that needs to do a sort allocates a buffer of this size. Increase this value for faster ORDER BY or GROUP BY operations. 30
  • 171. Per connection variables available for tweeking 31
  • 172. Per connection variables available for tweeking bulk_insert_buffer_size: 31
  • 173. Per connection variables available for tweeking bulk_insert_buffer_size: Dynamic variable - can be set per session 31
  • 174. Per connection variables available for tweeking bulk_insert_buffer_size: Dynamic variable - can be set per session Cache to make bulk inserts faster for INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA INFILE when adding data to non-empty tables. 31
  • 175. Per connection variables available for tweeking bulk_insert_buffer_size: Dynamic variable - can be set per session Cache to make bulk inserts faster for INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA INFILE when adding data to non-empty tables. Limits the size of the cache tree in bytes per thread. 31
  • 176. Per connection variables available for tweeking bulk_insert_buffer_size: Dynamic variable - can be set per session Cache to make bulk inserts faster for INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA INFILE when adding data to non-empty tables. Limits the size of the cache tree in bytes per thread. Set to 0 disables the optimization used 31
  • 177. Per connection variables available for tweeking 32
  • 178. Per connection variables available for tweeking join_buffer_size: 32
  • 179. Per connection variables available for tweeking join_buffer_size: Dynamic variable - can be set per session 32
  • 180. Per connection variables available for tweeking join_buffer_size: Dynamic variable - can be set per session Size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes - full table scans. 32
  • 181. Per connection variables available for tweeking join_buffer_size: Dynamic variable - can be set per session Size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes - full table scans. The best way to get fast joins is to add indexes. 32
  • 182. Per connection variables available for tweeking join_buffer_size: Dynamic variable - can be set per session Size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes - full table scans. The best way to get fast joins is to add indexes. Band Aid - don’t depend on it. 32
  • 183. 33
  • 184. 33
  • 185. MySQL Performance Tuning 101 Ligaya Turmelle MySQL Support Engineer ligaya@mysql.com 34

Editor's Notes

  1. Queries Systems - soft skill - like design * Slow query log * OS - is such a thing as over optimizing - time (long_query_time) * FileSystem - not use indexes * Network * EXPLAIN * Storage * Indexes strategies * Database design
  2. Queries Systems - soft skill - like design * Slow query log * OS - is such a thing as over optimizing - time (long_query_time) * FileSystem - not use indexes * Network * EXPLAIN * Storage * Indexes strategies * Database design
  3. Queries Systems - soft skill - like design * Slow query log * OS - is such a thing as over optimizing - time (long_query_time) * FileSystem - not use indexes * Network * EXPLAIN * Storage * Indexes strategies * Database design
  4. Queries Systems - soft skill - like design * Slow query log * OS - is such a thing as over optimizing - time (long_query_time) * FileSystem - not use indexes * Network * EXPLAIN * Storage * Indexes strategies * Database design
  5. Queries Systems - soft skill - like design * Slow query log * OS - is such a thing as over optimizing - time (long_query_time) * FileSystem - not use indexes * Network * EXPLAIN * Storage * Indexes strategies * Database design
  6. Global - Once - key buffer, InnoDB buffer pool size As needed - table and thread cache
  7. Global - Once - key buffer, InnoDB buffer pool size As needed - table and thread cache
  8. Global - Once - key buffer, InnoDB buffer pool size As needed - table and thread cache
  9. Global - Once - key buffer, InnoDB buffer pool size As needed - table and thread cache
  10. * Where do I look for information - Variables - LOTS of information.
  11. * Where do I look for information - Variables - LOTS of information.
  12. * Where do I look for information - Variables - LOTS of information.
  13. * Where do I look for information - Variables - LOTS of information.
  14. * Where do I look for information - Variables - LOTS of information.
  15. * Where do I look for information - Variables - LOTS of information.
  16. * Where do I look for information - Variables - LOTS of information.
  17. * Where do I look for information - Variables - LOTS of information.
  18. * Where do I look for information - Variables - LOTS of information.
  19. * Where do I look for information - Variables - LOTS of information.
  20. * Where do I look for information - Variables - LOTS of information.
  21. * Where do I look for information - Variables - LOTS of information.
  22. * Where do I look for information - Variables - LOTS of information.
  23. * Where do I look for information - Variables - LOTS of information.
  24. example of finding the delta
  25. example of finding the delta
  26. example of finding the delta
  27. example of finding the delta
  28. example of finding the delta
  29. example of finding the delta
  30. Innodb_buffer_pool_wait_free Normally, writes to the InnoDB buffer pool happen in the background. However, if it is necessary to read or create a page and no clean pages are available, it is also necessary to wait for pages to be flushed first. This counter counts instances of these waits. If the buffer pool size has been set properly, this value should be small. Added in MySQL 5.0.2.
  31. Innodb_buffer_pool_wait_free Normally, writes to the InnoDB buffer pool happen in the background. However, if it is necessary to read or create a page and no clean pages are available, it is also necessary to wait for pages to be flushed first. This counter counts instances of these waits. If the buffer pool size has been set properly, this value should be small. Added in MySQL 5.0.2.
  32. Innodb_buffer_pool_wait_free Normally, writes to the InnoDB buffer pool happen in the background. However, if it is necessary to read or create a page and no clean pages are available, it is also necessary to wait for pages to be flushed first. This counter counts instances of these waits. If the buffer pool size has been set properly, this value should be small. Added in MySQL 5.0.2.
  33. Innodb_buffer_pool_wait_free Normally, writes to the InnoDB buffer pool happen in the background. However, if it is necessary to read or create a page and no clean pages are available, it is also necessary to wait for pages to be flushed first. This counter counts instances of these waits. If the buffer pool size has been set properly, this value should be small. Added in MySQL 5.0.2.
  34. Innodb_buffer_pool_wait_free Normally, writes to the InnoDB buffer pool happen in the background. However, if it is necessary to read or create a page and no clean pages are available, it is also necessary to wait for pages to be flushed first. This counter counts instances of these waits. If the buffer pool size has been set properly, this value should be small. Added in MySQL 5.0.2.
  35. Innodb_buffer_pool_wait_free Normally, writes to the InnoDB buffer pool happen in the background. However, if it is necessary to read or create a page and no clean pages are available, it is also necessary to wait for pages to be flushed first. This counter counts instances of these waits. If the buffer pool size has been set properly, this value should be small. Added in MySQL 5.0.2.
  36. * Ask if people understand how the query cache works and if someone is not familiar with it - give a basic explanation. * Fragmentation - as Qcache_free_blocks approaches Qcache_total_blocks/2 the more severely fragmented the query cache is. Manual page fragmentation blurb - http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html &amp;#x201C; When a query is to be cached, its result (the data sent to the client) is stored in the query cache during result retrieval. Therefore the data usually is not handled in one big chunk. The query cache allocates blocks for storing this data on demand, so when one block is filled, a new block is allocated. Because memory allocation operation is costly (timewise), the query cache allocates blocks with a minimum size given by the query_cache_min_res_unit system variable. When a query is executed, the last result block is trimmed to the actual data size so that unused memory is freed. Depending on the types of queries your server executes, you might find it helpful to tune the value of query_cache_min_res_unit: * The default value of query_cache_min_res_unit is 4KB. This should be adequate for most cases. * If you have a lot of queries with small results, the default block size may lead to memory fragmentation, as indicated by a large number of free blocks. Fragmentation can force the query cache to prune (delete) queries from the cache due to lack of memory. In this case, you should decrease the value of query_cache_min_res_unit. The number of free blocks and queries removed due to pruning are given by the values of the Qcache_free_blocks and Qcache_lowmem_prunes status variables. * If most of your queries have large results (check the Qcache_total_blocks and Qcache_queries_in_cache status variables), you can increase performance by increasing query_cache_min_res_unit. However, be careful to not make it too large (see the previous item).&amp;#x201D;
  37. * Ask if people understand how the query cache works and if someone is not familiar with it - give a basic explanation. * Fragmentation - as Qcache_free_blocks approaches Qcache_total_blocks/2 the more severely fragmented the query cache is. Manual page fragmentation blurb - http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html &amp;#x201C; When a query is to be cached, its result (the data sent to the client) is stored in the query cache during result retrieval. Therefore the data usually is not handled in one big chunk. The query cache allocates blocks for storing this data on demand, so when one block is filled, a new block is allocated. Because memory allocation operation is costly (timewise), the query cache allocates blocks with a minimum size given by the query_cache_min_res_unit system variable. When a query is executed, the last result block is trimmed to the actual data size so that unused memory is freed. Depending on the types of queries your server executes, you might find it helpful to tune the value of query_cache_min_res_unit: * The default value of query_cache_min_res_unit is 4KB. This should be adequate for most cases. * If you have a lot of queries with small results, the default block size may lead to memory fragmentation, as indicated by a large number of free blocks. Fragmentation can force the query cache to prune (delete) queries from the cache due to lack of memory. In this case, you should decrease the value of query_cache_min_res_unit. The number of free blocks and queries removed due to pruning are given by the values of the Qcache_free_blocks and Qcache_lowmem_prunes status variables. * If most of your queries have large results (check the Qcache_total_blocks and Qcache_queries_in_cache status variables), you can increase performance by increasing query_cache_min_res_unit. However, be careful to not make it too large (see the previous item).&amp;#x201D;
  38. * Ask if people understand how the query cache works and if someone is not familiar with it - give a basic explanation. * Fragmentation - as Qcache_free_blocks approaches Qcache_total_blocks/2 the more severely fragmented the query cache is. Manual page fragmentation blurb - http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html &amp;#x201C; When a query is to be cached, its result (the data sent to the client) is stored in the query cache during result retrieval. Therefore the data usually is not handled in one big chunk. The query cache allocates blocks for storing this data on demand, so when one block is filled, a new block is allocated. Because memory allocation operation is costly (timewise), the query cache allocates blocks with a minimum size given by the query_cache_min_res_unit system variable. When a query is executed, the last result block is trimmed to the actual data size so that unused memory is freed. Depending on the types of queries your server executes, you might find it helpful to tune the value of query_cache_min_res_unit: * The default value of query_cache_min_res_unit is 4KB. This should be adequate for most cases. * If you have a lot of queries with small results, the default block size may lead to memory fragmentation, as indicated by a large number of free blocks. Fragmentation can force the query cache to prune (delete) queries from the cache due to lack of memory. In this case, you should decrease the value of query_cache_min_res_unit. The number of free blocks and queries removed due to pruning are given by the values of the Qcache_free_blocks and Qcache_lowmem_prunes status variables. * If most of your queries have large results (check the Qcache_total_blocks and Qcache_queries_in_cache status variables), you can increase performance by increasing query_cache_min_res_unit. However, be careful to not make it too large (see the previous item).&amp;#x201D;
  39. * Ask if people understand how the query cache works and if someone is not familiar with it - give a basic explanation. * Fragmentation - as Qcache_free_blocks approaches Qcache_total_blocks/2 the more severely fragmented the query cache is. Manual page fragmentation blurb - http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html &amp;#x201C; When a query is to be cached, its result (the data sent to the client) is stored in the query cache during result retrieval. Therefore the data usually is not handled in one big chunk. The query cache allocates blocks for storing this data on demand, so when one block is filled, a new block is allocated. Because memory allocation operation is costly (timewise), the query cache allocates blocks with a minimum size given by the query_cache_min_res_unit system variable. When a query is executed, the last result block is trimmed to the actual data size so that unused memory is freed. Depending on the types of queries your server executes, you might find it helpful to tune the value of query_cache_min_res_unit: * The default value of query_cache_min_res_unit is 4KB. This should be adequate for most cases. * If you have a lot of queries with small results, the default block size may lead to memory fragmentation, as indicated by a large number of free blocks. Fragmentation can force the query cache to prune (delete) queries from the cache due to lack of memory. In this case, you should decrease the value of query_cache_min_res_unit. The number of free blocks and queries removed due to pruning are given by the values of the Qcache_free_blocks and Qcache_lowmem_prunes status variables. * If most of your queries have large results (check the Qcache_total_blocks and Qcache_queries_in_cache status variables), you can increase performance by increasing query_cache_min_res_unit. However, be careful to not make it too large (see the previous item).&amp;#x201D;
  40. * Ask if people understand how the query cache works and if someone is not familiar with it - give a basic explanation. * Fragmentation - as Qcache_free_blocks approaches Qcache_total_blocks/2 the more severely fragmented the query cache is. Manual page fragmentation blurb - http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html &amp;#x201C; When a query is to be cached, its result (the data sent to the client) is stored in the query cache during result retrieval. Therefore the data usually is not handled in one big chunk. The query cache allocates blocks for storing this data on demand, so when one block is filled, a new block is allocated. Because memory allocation operation is costly (timewise), the query cache allocates blocks with a minimum size given by the query_cache_min_res_unit system variable. When a query is executed, the last result block is trimmed to the actual data size so that unused memory is freed. Depending on the types of queries your server executes, you might find it helpful to tune the value of query_cache_min_res_unit: * The default value of query_cache_min_res_unit is 4KB. This should be adequate for most cases. * If you have a lot of queries with small results, the default block size may lead to memory fragmentation, as indicated by a large number of free blocks. Fragmentation can force the query cache to prune (delete) queries from the cache due to lack of memory. In this case, you should decrease the value of query_cache_min_res_unit. The number of free blocks and queries removed due to pruning are given by the values of the Qcache_free_blocks and Qcache_lowmem_prunes status variables. * If most of your queries have large results (check the Qcache_total_blocks and Qcache_queries_in_cache status variables), you can increase performance by increasing query_cache_min_res_unit. However, be careful to not make it too large (see the previous item).&amp;#x201D;
  41. * If it is set to a value that is not a multiple of 4KB, its value will be rounded down to the nearest multiple of 4KB.
  42. * If it is set to a value that is not a multiple of 4KB, its value will be rounded down to the nearest multiple of 4KB.
  43. * If it is set to a value that is not a multiple of 4KB, its value will be rounded down to the nearest multiple of 4KB.
  44. * If it is set to a value that is not a multiple of 4KB, its value will be rounded down to the nearest multiple of 4KB.
  45. * If it is set to a value that is not a multiple of 4KB, its value will be rounded down to the nearest multiple of 4KB.
  46. * If it is set to a value that is not a multiple of 4KB, its value will be rounded down to the nearest multiple of 4KB.
  47. * If it is set to a value that is not a multiple of 4KB, its value will be rounded down to the nearest multiple of 4KB.