SlideShare a Scribd company logo
Performance Tuning the MySQL Server Ligaya Turmelle MySQL Support Engineer [email_address]
MySQL is the world's most popular open source database software, with over 100 million copies of its software downloaded or distributed throughout its history.
a key part of LAMP (Linux, Apache, MySQL, PHP / Perl / Python), the fast-growing open source enterprise software stack.
Site:  http://www.mysql.com/
Download: http://dev.mysql.com/downloads/
Online Manual: http://dev.mysql.com/doc/refman/5.1/en/index.html MySQL
Before Before you start tweaking the server: Your single biggest gain in server performance will be from optimizing your queries EXPLAIN
Indexes strategies
Database design Optimize the underlying server systems OS
File system
Network
Storage
How MySQL uses memory MySQL uses memory in 2 ways  – Global buffers and per connection buffers.
Generally speaking global memory is allocated once when the server starts *
Per connection memory allocations are for each connection - generally speaking on an “as needed” basis. These buffers should be “small” Global memory + (max_connections * session buffers)
* some of the Global buffers grow to their size like the table and thread caches
Where to get information mysql> SHOW GLOBAL VARIABLES; This command will show us what the current settings of the server are.
+---------------------------------+-----------------------------------------------------------------------------------------------+
| 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
....
Where to get information (con't) my.cnf file This file can also contain information not found in the global variables Server information How much RAM on the machine?
Is the machine dedicated to MySQL?
64 bit processor?
64 bit MySQL server binary?
Where to get information (con't) mysql> SHOW GLOBAL STATUS; This command will give you information on what the server has been doing.

More Related Content

PDF
A day in the life of a click house query
PDF
Webinar: Strength in Numbers: Introduction to ClickHouse Cluster Performance
PDF
Your first ClickHouse data warehouse
PDF
Better than you think: Handling JSON data in ClickHouse
PDF
All about Zookeeper and ClickHouse Keeper.pdf
PDF
Altinity Quickstart for ClickHouse
PDF
MariaDB and Clickhouse Percona Live 2019 talk
PDF
Polyglot ClickHouse -- ClickHouse SF Meetup Sept 10
A day in the life of a click house query
Webinar: Strength in Numbers: Introduction to ClickHouse Cluster Performance
Your first ClickHouse data warehouse
Better than you think: Handling JSON data in ClickHouse
All about Zookeeper and ClickHouse Keeper.pdf
Altinity Quickstart for ClickHouse
MariaDB and Clickhouse Percona Live 2019 talk
Polyglot ClickHouse -- ClickHouse SF Meetup Sept 10

What's hot (20)

PDF
Webinar slides: Adding Fast Analytics to MySQL Applications with Clickhouse
PDF
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
PDF
ClickHouse Monitoring 101: What to monitor and how
PDF
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
PDF
ClickHouse Materialized Views: The Magic Continues
PDF
Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021
PDF
Creating Beautiful Dashboards with Grafana and ClickHouse
PDF
Altinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
PDF
ClickHouse Deep Dive, by Aleksei Milovidov
PDF
Fun with click house window functions webinar slides 2021-08-19
PDF
ClickHouse Mark Cache, by Mik Kocikowski, Cloudflare
PPTX
High Performance, High Reliability Data Loading on ClickHouse
PDF
Clickhouse Capacity Planning for OLAP Workloads, Mik Kocikowski of CloudFlare
PDF
Tiered storage intro. By Robert Hodges, Altinity CEO
PDF
ClickHouse Defense Against the Dark Arts - Intro to Security and Privacy
PDF
Materialize: a platform for changing data
PDF
Introduction to the Mysteries of ClickHouse Replication, By Robert Hodges and...
PDF
ClickHouse new features and development roadmap, by Aleksei Milovidov
PDF
Fast Insight from Fast Data: Integrating ClickHouse and Apache Kafka
PDF
ClickHouse on Kubernetes, by Alexander Zaitsev, Altinity CTO
Webinar slides: Adding Fast Analytics to MySQL Applications with Clickhouse
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Monitoring 101: What to monitor and how
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
ClickHouse Materialized Views: The Magic Continues
Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021
Creating Beautiful Dashboards with Grafana and ClickHouse
Altinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
ClickHouse Deep Dive, by Aleksei Milovidov
Fun with click house window functions webinar slides 2021-08-19
ClickHouse Mark Cache, by Mik Kocikowski, Cloudflare
High Performance, High Reliability Data Loading on ClickHouse
Clickhouse Capacity Planning for OLAP Workloads, Mik Kocikowski of CloudFlare
Tiered storage intro. By Robert Hodges, Altinity CEO
ClickHouse Defense Against the Dark Arts - Intro to Security and Privacy
Materialize: a platform for changing data
Introduction to the Mysteries of ClickHouse Replication, By Robert Hodges and...
ClickHouse new features and development roadmap, by Aleksei Milovidov
Fast Insight from Fast Data: Integrating ClickHouse and Apache Kafka
ClickHouse on Kubernetes, by Alexander Zaitsev, Altinity CTO
Ad

Viewers also liked (19)

PDF
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
PDF
Webinar 2013 advanced_query_tuning
PPTX
MySQL Performance Tips & Best Practices
PDF
MySQL Performance Tuning: Top 10 Tips
PPTX
Mysql performance tuning
PDF
浅析My sql事务隔离级别与锁 seanlook
PDF
MySQL Server Settings Tuning
PDF
MySQL Performance Tuning für Entwickler
KEY
Perf Tuning Short
PDF
MySQL Performance Tuning Variables
PDF
MySQL Performance Tuning
PDF
Performance Tuning Best Practices
PDF
Join-fu: The Art of SQL Tuning for MySQL
PPTX
MySQL Indexing - Best practices for MySQL 5.6
PDF
MySQL查询优化浅析
PDF
MySQL Manchester TT - Performance Tuning
PDF
Mysql Explain Explained
PDF
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
PDF
How to Design Indexes, Really
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
Webinar 2013 advanced_query_tuning
MySQL Performance Tips & Best Practices
MySQL Performance Tuning: Top 10 Tips
Mysql performance tuning
浅析My sql事务隔离级别与锁 seanlook
MySQL Server Settings Tuning
MySQL Performance Tuning für Entwickler
Perf Tuning Short
MySQL Performance Tuning Variables
MySQL Performance Tuning
Performance Tuning Best Practices
Join-fu: The Art of SQL Tuning for MySQL
MySQL Indexing - Best practices for MySQL 5.6
MySQL查询优化浅析
MySQL Manchester TT - Performance Tuning
Mysql Explain Explained
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
How to Design Indexes, Really
Ad

Similar to Performance Tuning (20)

KEY
Tek tutorial
DOCX
Performence tuning
KEY
DPC Tutorial
PDF
Perf tuning2
PDF
MySQL performance webinar
ODP
MySQL Scaling Presentation
PDF
Highload Perf Tuning
PPTX
Оптимизация MySQL. Что должен знать каждый разработчик
PPT
MySQL Performance Tuning - GNUnify 2010
PPT
MySQL Performance Tuning at COSCUP 2014
PPT
MySQL Performance Secrets
PDF
Monitoreo de MySQL y PostgreSQL con SQL
PPTX
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
PPTX
MySQL performance tuning
PDF
Loadays MySQL
PDF
MySQL 5.6 Performance
PPTX
Percona Live UK 2014 Part III
PPT
15 protips for mysql users pfz
PDF
16 MySQL Optimization #burningkeyboards
Tek tutorial
Performence tuning
DPC Tutorial
Perf tuning2
MySQL performance webinar
MySQL Scaling Presentation
Highload Perf Tuning
Оптимизация MySQL. Что должен знать каждый разработчик
MySQL Performance Tuning - GNUnify 2010
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Secrets
Monitoreo de MySQL y PostgreSQL con SQL
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
MySQL performance tuning
Loadays MySQL
MySQL 5.6 Performance
Percona Live UK 2014 Part III
15 protips for mysql users pfz
16 MySQL Optimization #burningkeyboards

More from Ligaya Turmelle (9)

PDF
Troubleshooting tldr
PDF
Rootconf admin101
PDF
Zend2016 dba tutorial
KEY
Normalization
KEY
Character sets
PPT
MySQL 5.1 Replication
PPT
MySQL 5.5
PPT
Php Community
ODP
Troubleshooting tldr
Rootconf admin101
Zend2016 dba tutorial
Normalization
Character sets
MySQL 5.1 Replication
MySQL 5.5
Php Community

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
A Presentation on Artificial Intelligence
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Understanding_Digital_Forensics_Presentation.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
The AUB Centre for AI in Media Proposal.docx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
NewMind AI Monthly Chronicles - July 2025
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
NewMind AI Weekly Chronicles - August'25 Week I
A Presentation on Artificial Intelligence
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Chapter 3 Spatial Domain Image Processing.pdf

Performance Tuning

  • 1. Performance Tuning the MySQL Server Ligaya Turmelle MySQL Support Engineer [email_address]
  • 2. MySQL is the world's most popular open source database software, with over 100 million copies of its software downloaded or distributed throughout its history.
  • 3. a key part of LAMP (Linux, Apache, MySQL, PHP / Perl / Python), the fast-growing open source enterprise software stack.
  • 7. Before Before you start tweaking the server: Your single biggest gain in server performance will be from optimizing your queries EXPLAIN
  • 9. Database design Optimize the underlying server systems OS
  • 13. How MySQL uses memory MySQL uses memory in 2 ways – Global buffers and per connection buffers.
  • 14. Generally speaking global memory is allocated once when the server starts *
  • 15. Per connection memory allocations are for each connection - generally speaking on an “as needed” basis. These buffers should be “small” Global memory + (max_connections * session buffers)
  • 16. * some of the Global buffers grow to their size like the table and thread caches
  • 17. Where to get information mysql> SHOW GLOBAL VARIABLES; This command will show us what the current settings of the server are.
  • 19. | Variable_name | Value |
  • 24. | back_log | 50 |
  • 25. | basedir | /Users/ligaya/mysql_installs/mysql-enterprise-gpl-5.0.50sp1-osx10.5-x86/ |
  • 26. | binlog_cache_size | 32768 |
  • 29. ....
  • 30. Where to get information (con't) my.cnf file This file can also contain information not found in the global variables Server information How much RAM on the machine?
  • 31. Is the machine dedicated to MySQL?
  • 33. 64 bit MySQL server binary?
  • 34. Where to get information (con't) mysql> SHOW GLOBAL STATUS; This command will give you information on what the server has been doing.
  • 35. You will want to issue this command twice with some time in between so you can see the change in the information over time mysql> SHOW GLOBAL STATUS;
  • 37. mysql> SHOW GLOBAL STATUS; Sample Output:
  • 38. Where to get information (con't) +-----------------------------------+-------------+ | 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 | +-----------------------------------+-------------+
  • 39. Where to get information (con't) Uptime This information is taken from the status information and is given in number of seconds. Ex: 1086122 seconds = ~19.9 days = 478.5 hrs This helps you calculate the values in a given time frame and since we have 2 Global status outputs we can see what the change in the values are for a given time under specific circumstances (high load, low load). Ex: (bytes received[2] – bytes received[1])/ (Uptime[2] – Uptime[1])
  • 40. (1320582719 - 1320510015 )/(1722729 - 1722523) =
  • 41. 72704 bytes/ 206 sec = 352.9 bytes/sec
  • 42. What is the database doing? Com_xxx The Com_xxx statement counter variables indicate the number of times each xxx statement has been executed. There is one status variable for each type of statement. | Com_create_table | 1349 |
  • 43. | Com_delete | 78813 |
  • 44. | Com_insert | 100357 |
  • 45. | Com_replace | 3130 |
  • 46. | Com_select | 984292 |
  • 47. | Com_show_tables | 459 |
  • 49. | Com_update | 285105 | You can then use this information with the Uptime to find out how well your database is handling the demands it is under – inserts/sec, deletes/sec, etc.
  • 50. What is the database doing? (con't) Handler_* These are various internal counters. The ones below indicate how well the indexes on your queries are working. Handler_read_first: number of times the first entry was read from an index.
  • 51. value is high, it suggests that the server is doing a lot of full index scans . Handler_read_key: number of requests to read a row based on a key.
  • 52. value is high, it is a good indication that your tables are properly indexed for your queries. Handler_read_next: number of requests to read the next row in key order.
  • 53. value is incremented if you are querying an index column with a range constraint or if you are doing an index scan .
  • 54. What is the database doing? (con't) Handler_* (con't) Handler_read_prev: number of requests to read the previous row in key order.
  • 55. mainly used to optimize ORDER BY ... DESC . Handler_read_rnd: number of requests to read a row based on a fixed position.
  • 56. value is high if you are doing a lot of queries that require sorting of the result .
  • 57. probably have a lot of queries that require MySQL to scan entire tables or you have joins that don't use keys properly. Handler_read_rnd_next: number of requests to read the next row in the data file.
  • 58. value is high if you are doing a lot of table scans.
  • 59. suggests that your tables are not properly indexed or your queries are not written to take advantage of the indexes you have.
  • 60. What is the database doing? (con't) Innodb_* This has various information on how the InnoDB tablespace is doing.
  • 61. Some of the information available: 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.
  • 62. What is the database doing? (con't) Key_* This provides you with information on how your key buffer is doing. (MyISAM) Key_blocks_unused: number of unused blocks in the key cache.
  • 63. use this value to determine how much of the key cache is in use Key_blocks_used: number of used blocks in the key cache.
  • 64. a high-water mark that indicates the maximum number of blocks that have ever been in use at one time.
  • 65. What is the database doing? (con't) Key_* This provides you with information on how your key buffer is doing. (MyISAM) (con't) Key_read_requests: number of requests to read a key block from the cache.
  • 66. a cache hit Key_reads: number of physical reads of a key block from disk.
  • 68. If large, then your key_buffer_size value is probably too small . cache miss rate = Key_reads/Key_read_requests.
  • 69. Key buffer efficiency : 1 – cache miss rate
  • 70. What is the database doing? (con't) Qcache_* These counters provide you with information on how the query cache is doing. Qcache_free_blocks: number of free memory blocks
  • 71. Qcache_hits: number of query cache hits.
  • 72. Qcache_inserts: number of queries added to the query cache.
  • 73. Qcache_lowmem_prunes: number of queries that were deleted from the query cache because of low memory.
  • 74. Qcache_not_cached: number of non-cached queries (not cacheable, or not cached due to the query_cache_type setting).
  • 75. Qcache_queries_in_cache: number of queries registered in the query cache.
  • 76. Qcache_total_blocks: total number of blocks in the query cache.
  • 77. What is the database doing? (con't) Qcache_* 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
  • 78. What is the database doing? (con't) Just a few general information statuses on what the database is doing Connections: number of connection attempts (successful or not) to the MySQL server.
  • 79. Queries: number of statements executed by the server. This variable includes statements executed within stored programs, unlike the Questions variable. This variable was added in MySQL 5.0.76.
  • 80. Questions: The number of statements executed by the server. As of MySQL 5.0.72, this includes only statements sent to the server by clients and no longer includes statements executed within stored programs, unlike the Queries variable.
  • 81. Slow_queries: The number of queries that have taken more than long_query_time seconds.
  • 82. What is the database doing? (con't) General information statuses (con't) Sort_merge_passes: number of merge passes that the sort algorithm has had to do. If this value is large, you should consider increasing the value of the sort_buffer_size system variable.
  • 83. Table_locks_immediate: number of times a table lock was granted immediately. Typically associate with MyISAM.
  • 84. Table_locks_waited: number of times we had to wait to get a table lock. Typically associate with MyISAM. If high you may need to consider changing storage engines. Threads_cached: number of threads in the thread cache.
  • 85. Threads_connected: number of currently open connections.
  • 86. Threads_created: number of threads created to handle connections. If Threads_created is big, you may want to increase the thread_cache_size value.
  • 87. The cache miss rate can be calculated as Threads_created/Connections.
  • 88. What is the database doing? (con't) More information on JOINS Select_full_join: number of joins that perform table scans because they do not use indexes. If this value is not 0, you should carefully check the indexes of your tables. Select_range_check: number of joins without keys that check for key usage after each row. If this is not 0, you should carefully check the indexes of your tables. Select_full_range_join: number of joins that used a range search on a reference table. Select_scan: number of joins that did a full scan of the first table. Select_range: number of joins that used ranges on the first table.
  • 89. Variables for tweaking Globals Main ones: innodb_buffer_pool_size: The size in bytes of the memory buffer InnoDB uses to cache data and indexes of its tables. The larger you set this value, the less disk I/O is needed to access data in tables.
  • 90. On a dedicated database server, you may set this to up to 80% of the machine physical memory size. However, do not set it too large because competition for physical memory might cause paging in the operating system.
  • 91. Variables for tweaking Globals Main ones: innodb_log_file_size: larger the value, the less checkpoint flush activity is needed in the buffer pool, saving disk I/O
  • 92. larger the log files longer the crash recovery time
  • 93. size in bytes of each log file in a log group.
  • 94. combined size of log files must be less than 4GB
  • 95. Sensible values range from 1MB to 1/N-th of the size of the buffer pool, where N is the number of log files in the group (innodb_log_files_in_group).
  • 96. Variables for tweaking Globals Main ones (con't) key_buffer_size: Index blocks for MyISAM tables are buffered and are shared by all threads. key_buffer_size is the size of the buffer used for index blocks.
  • 97. The maximum allowable setting for key_buffer_size is 4GB on 32-bit platforms. As of MySQL 5.0.52, values larger than 4GB are allowed for 64-bit platforms.
  • 98. Using a value that is 25% of total memory on a machine that mainly runs MySQL is quite common. However, if you make the value too large your system might start to page and become extremely slow.
  • 99. Variables for tweaking Globals Lesser ones: table_cache: The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires.
  • 100. You can check whether you need to increase the table cache by checking the Opened_tables status variable. If the value of Opened_tables is constantly increasing and you don't do FLUSH TABLES often (which just forces all tables to be closed and reopened), then you should increase the value of the table_cache variable.
  • 101. Variables for tweaking Globals Lesser ones: thread_cache_size: threads the server should cache for reuse. When a client disconnects, the client's threads are put in the cache if there are fewer than thread_cache_size threads there.
  • 102. Requests for threads are satisfied by reusing threads taken from the cache if possible, and 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
  • 103. Variables for tweaking Globals Lesser ones: query_cache_size: The amount of memory allocated for caching query results.
  • 104. default value is 0, which disables the query cache.
  • 105. allowable values are multiples of 1024; other values are rounded down to the nearest multiple.
  • 106. Note that query_cache_size bytes of memory are allocated even if query_cache_type is set to 0.
  • 107. Variables for tweaking Per Session max_heap_table_size: sets the maximum size to which MEMORY tables are allowed to grow. tmp_table_size: maximum size of internal in-memory temporary tables. (The actual limit is determined as the smaller of max_heap_table_size and tmp_table_size.)
  • 108. If an in-memory temporary table exceeds the limit, MySQL automatically converts it to an on-disk MyISAM table.
  • 109. Variables for tweaking Per Session (con't) read_buffer_size: 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.
  • 110. The value of this variable should be a multiple of 4KB. 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.
  • 111. The maximum allowable setting is 2GB though we do not normally recommend having it higher then 8M.
  • 112. Variables for tweaking Per Session (con't) read_rnd_buffer_size: When reading rows in sorted order following a key-sorting operation, the rows are read through this buffer to avoid disk seeks.
  • 113. Setting the variable to a large value can improve ORDER BY performance by a lot.
  • 114. The maximum allowable setting is 2GB though we do not normally recommend having it higher then 8M. sort_buffer_size: 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.
  • 115. Variables for tweaking Per Session (con't) bulk_insert_buffer_size: MyISAM uses a special tree-like cache to make bulk inserts faster for INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA INFILE when adding data to non-empty tables.
  • 116. limits the size of the cache tree in bytes per thread. join_buffer_size: size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes and thus perform full table scans.
  • 117. the best way to get fast joins is to add indexes.
  • 118. Variables for tweaking Per Session (con't) max_allowed_packet : maximum size of one packet or any generated/intermediate string.
  • 119. The packet message buffer is initialized to net_buffer_length bytes, but can grow up to max_allowed_packet bytes when needed.
  • 120. value by default is small, to catch large (possibly incorrect) packets. You must increase this value if you are using large BLOB columns or long strings. It should be as big as the largest BLOB you want to use.
  • 121. Variables for tweaking Per Session (con't) myisam_max_sort_file_size: maximum size of the temporary file that MySQL is allowed to use while re-creating a MyISAM index (during REPAIR TABLE, ALTER TABLE, or LOAD DATA INFILE).
  • 122. If the file size would be larger than this value, the index is created using the key cache instead, which is slower.
  • 123. The value is given in bytes. myisam_sort_buffer_size: size of the buffer that is allocated when sorting MyISAM indexes during a REPAIR TABLE or when creating indexes with CREATE INDEX or ALTER TABLE
  • 125. Performance Tuning the MySQL Server Ligaya Turmelle MySQL Support Engineer [email_address]