Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
What to Upload to SlideShare
What to Upload to SlideShare
Loading in …3
×
1 of 141

MySQL Performance for DevOps

0

Share

Download to read offline

MySQL performance can be improved by tuning queries, server options, and hardware. Traditionally it was an area of responsibility of three different roles: Development, DBA and System Administrators. Now DevOps handle these all. But there is a gap. Knowledge, gained by MySQL DBAs after years or focus on the single product is hard to gain when you focus on more than one. This is why I am doing this session. I will show minimal, but the most effective, set of options which will improve MySQL performance. For illustrations, I will use real user stories, gained by my Support experience, and Kubernetes operators, now available from all main MySQL eco-system vendors: Oracle, MariaDB, and Percona.

Presented at Open Source Summit Europe 2020: https://sched.co/eCGf

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

MySQL Performance for DevOps

  1. 1. MySQL Performance for DevOps October 26, 2020 Sveta Smirnova
  2. 2. • MySQL Support engineer • Author of • MySQL Troubleshooting • JSON UDF functions • FILTER clause for MySQL • Speaker • Percona Live, OOW, Fosdem, DevConf, HighLoad... Sveta Smirnova 2
  3. 3. •Introduction •Hardware Memory Disk CPU Network •Configuration Important Options •Query Tuning on the Server Side Indexes Optimizer Histograms Optimizer Configuration Table of Contents 3
  4. 4. Introduction
  5. 5. • Database server • 25 years of history • Popular forks • Percona Server for MySQL • MariaDB Server • Replication support from the beginning What is MySQL? 5
  6. 6. Connectors: C, JDBC, ODBC, Python, ... Connection Pool: Authentication, Caches SQL interface Parser Optimizer Caches and Buffers: Global Engine-specific Storage engines: InnoDB, MyRocks, ... File system: Data, Index, logs, other files • mysqld and its files • Connectors • Optimizer • Caches • Storage Engines • Management MySQL Architecture 6
  7. 7. • Bare hardware • Cloud • Container-orchestration systems Where MySQL Installed in 2020? 7
  8. 8. Percona Kubernetes Operator for PXC MySQL Operator MySQL Kubernetes Operators 8
  9. 9. Query ConfigurationHardware What Affects Performance? 9
  10. 10. Hardware
  11. 11. • Bare hardware • Operating system options How to Tune? 11
  12. 12. • Bare hardware • Operating system options • Clouds • Administrator console How to Tune? 11
  13. 13. • Bare hardware • Operating system options • Clouds • Administrator console • Percona Kubernetes Operator for PXC cr.yaml pxc.resources.requests.memory pxc.resources.requests.cpu pxc.resources.limits.memory pxc.volumeSpec.resources.requests.storage How to Tune? 11
  14. 14. • Memory • Disk • CPU • Network What to Tune? 12
  15. 15. Hardware Memory
  16. 16. • No swapping: sysctl vm.swappiness=1 Memory Configuration 14
  17. 17. • No swapping: sysctl vm.swappiness=1 • NUMA interleave: enable in BIOS Memory Configuration 14
  18. 18. • No swapping: sysctl vm.swappiness=1 • NUMA interleave: enable in BIOS • More is better Memory Configuration 14
  19. 19. • No swapping: sysctl vm.swappiness=1 • NUMA interleave: enable in BIOS • More is better • Memory access is faster than disk access Memory Configuration 14
  20. 20. • No swapping: sysctl vm.swappiness=1 • NUMA interleave: enable in BIOS • More is better • Memory access is faster than disk access • Frequently accessed data should be in memory Memory Configuration 14
  21. 21. • Global buffers • Allocated up to the limit and freed at shutdown InnoDB Buffer Pool Size Performance Schema tables How MySQL Uses Memory 15
  22. 22. • Global buffers • Session buffers • Allocated when session starts • Freed at the disconnect Connection and result buffers: from net buffer length up to max allowed packet How MySQL Uses Memory 15
  23. 23. • Global buffers • Session buffers • Operation-specific buffers • Allocated for the operation life time • Can be allocated multiple times join buffer size: for each tables pair in JOIN tmp table size: for each temporary table How MySQL Uses Memory 15
  24. 24. Hardware Disk
  25. 25. • Faster is better • SSD • NVMe • Spinning disk Disk Configuration 17
  26. 26. • Faster is better • SSD • NVMe • Spinning disk • Parallel writes Disk Configuration 17
  27. 27. • Faster is better • SSD • NVMe • Spinning disk • Parallel writes • Battery-backed cache Disk Configuration 17
  28. 28. • Tables data How MySQL Uses Disk 18
  29. 29. • Tables data • Log files • Binary • Storage engine InnoDB redo log file • Error, general, audit, ... How MySQL Uses Disk 18
  30. 30. • Tables data • Log files • Binary • Storage engine InnoDB redo log file • Error, general, audit, ... • Disk-based temporary tables How MySQL Uses Disk 18
  31. 31. • Tables data • Log files • Binary • Storage engine InnoDB redo log file • Error, general, audit, ... • Disk-based temporary tables • You may put these on different disks How MySQL Uses Disk 18
  32. 32. Hardware CPU
  33. 33. • IO scheduler [noop] or [deadline] • sudo echo noop > /sys/block/YOUR DISK/queue/scheduler or sudo echo deadline > /sys/block/YOUR DISK/queue/scheduler CPU Configuration 20
  34. 34. • IO scheduler [noop] or [deadline] • sudo echo noop > /sys/block/YOUR DISK/queue/scheduler or sudo echo deadline > /sys/block/YOUR DISK/queue/scheduler • CPU governor: set to performance CPU Configuration 20
  35. 35. • IO scheduler [noop] or [deadline] • sudo echo noop > /sys/block/YOUR DISK/queue/scheduler or sudo echo deadline > /sys/block/YOUR DISK/queue/scheduler • CPU governor: set to performance • More cores is better CPU Configuration 20
  36. 36. • One thread per connection • CPU used only for active threads How MySQL Uses CPU 21
  37. 37. • One thread per connection • CPU used only for active threads • Background work by storage engines How MySQL Uses CPU 21
  38. 38. Server Storage Engine Connection and Engine Threads 22
  39. 39. ? <= CPU cores? What Happens with Threads 23
  40. 40. ? <= CPU cores? Yes Executed simultaneously What Happens with Threads 23
  41. 41. ? <= CPU cores? Yes Executed simultaneously No Wait in a queue What Happens with Threads 23
  42. 42. ? <= CPU cores? Yes Executed simultaneously No Wait in a queue ? Does the disk support parallel write? What Happens with Threads 23
  43. 43. ? <= CPU cores? Yes Executed simultaneously No Wait in a queue ? Does the disk support parallel write? Yes Write happens What Happens with Threads 23
  44. 44. ? <= CPU cores? Yes Executed simultaneously No Wait in a queue ? Does the disk support parallel write? Yes Write happens No Wait in a queue What Happens with Threads 23
  45. 45. Hardware Network
  46. 46. • As fast as possible • Speed of the line RTT • Bandwidth • Stability To avoid TCP packet re-submission Network Configuration 25
  47. 47. • As fast as possible • On the Internet connection • Clients can work • Asynchronous replica will delay • Synchronous clusters will be not functional Node disconnects with default options Very slow response times with adjusted configuration Network Configuration 25
  48. 48. • Communication between server and client • Regular client • Application • Replication connection (IO) thread • Traffic between synchronous nodes How MySQL Uses Network 26
  49. 49. Configuration
  50. 50. • Server options • Components • Storage engines InnoDB • Plugins • Server Binary logging Optimizer What can be Configured? 28
  51. 51. • Global • Parameters, necessary for all server processes Location of server files: datadir etc. Shared buffers More • Session • Control connection-specific parameters MySQL Option Tables System Variables and Options: Scope 29
  52. 52. • SET [GLOBAL|PERSIST] var = NEW VALUE System Variables: How to Change 30
  53. 53. • SET [GLOBAL|PERSIST] var = NEW VALUE • Command-line option: --var=new value System Variables: How to Change 30
  54. 54. • SET [GLOBAL|PERSIST] var = NEW VALUE • Command-line option: --var=new value • Configuration file In the default location • Specified by option --defaults-file [mysqld] var=new_value System Variables: How to Change 30
  55. 55. • PXC Operator Configuration • In cr.yaml spec: secretsName: my-cluster-secrets pxc: ... configuration: | [mysqld] innodb_log_file_size=8G System Variables: How to Change 30
  56. 56. • PXC Operator Configuration • In ConfigMap Create custom configuration file my.cnf [mysqld] innodb_log_file_size=8G System Variables: How to Change 30
  57. 57. • PXC Operator Configuration • In ConfigMap Create custom configuration file my.cnf [mysqld] innodb_log_file_size=8G Create ConfigMap: kubectl create configmap cluster1-pxc --from-file=my.cnf System Variables: How to Change 30
  58. 58. • PXC Operator Configuration • In ConfigMap Create custom configuration file my.cnf [mysqld] innodb_log_file_size=8G Create ConfigMap: kubectl create configmap cluster1-pxc --from-file=my.cnf Restart PXC System Variables: How to Change 30
  59. 59. • Global options and few session options < 8.0 A user with privilege SUPER 8.0 + A user with privilege SYSTEM VARIABLES ADMIN Dynamic Variables: Who Can Change 31
  60. 60. • Global options and few session options < 8.0 A user with privilege SUPER 8.0 + A user with privilege SYSTEM VARIABLES ADMIN • Session options < 8.0 Anybody 8.0 + Restricted privileges SYSTEM VARIABLES ADMIN SESSION VARIABLES ADMIN 8.0 + Not restricted privileges: anybody Dynamic Variables: Who Can Change 31
  61. 61. • Global options and few session options < 8.0 A user with privilege SUPER 8.0 + A user with privilege SYSTEM VARIABLES ADMIN • Session options < 8.0 Anybody 8.0 + Restricted privileges SYSTEM VARIABLES ADMIN SESSION VARIABLES ADMIN 8.0 + Not restricted privileges: anybody • There are no limits! Dynamic Variables: Who Can Change 31
  62. 62. • Those which control behavior of whole server • Once at server startup • Can start with low values, then grow to specified Buffers: When Allocated 32
  63. 63. • Those which control behavior of whole server • Once at server startup • Can start with low values, then grow to specified • Connection options • For every connection when connection opens Buffers: When Allocated 32
  64. 64. • Those which control behavior of whole server • Once at server startup • Can start with low values, then grow to specified • Connection options • For every connection when connection opens • Operation-specific • For every operation when needed • Can be allocated more than once Buffers: When Allocated 32
  65. 65. Configuration Important Options
  66. 66. • innodb buffer pool size • Ideally should hold active data set InnoDB 34
  67. 67. • innodb buffer pool size • innodb log file size • Should hold changes for an hour InnoDB 34
  68. 68. • innodb buffer pool size • innodb log file size • Should hold changes for an hour • Too low InnoDB 34
  69. 69. • innodb buffer pool size • innodb log file size • Should hold changes for an hour • Good InnoDB 34
  70. 70. • innodb buffer pool size • innodb log file size • innodb thread concurrency • 0 or number of CPU cores InnoDB 34
  71. 71. • innodb buffer pool size • innodb log file size • innodb thread concurrency • innodb io capacity • Default is too small for fast disks • Up to number of IOPS your disk can handle InnoDB 34
  72. 72. • innodb buffer pool size • innodb log file size • innodb thread concurrency • innodb io capacity • innodb flush method • In most cases: O DIRECT • Test on your filesystem! InnoDB 34
  73. 73. • Changing these compromize durability! Synchronization 35
  74. 74. • Changing these compromize durability! • innodb flush log at trx commit 1: full ACID, default Synchronization 35
  75. 75. • Changing these compromize durability! • innodb flush log at trx commit 1: full ACID, default 2: logs written at each commit, flushed per second MySQL can handle up to 1M INSERTs per second Safe with PXC and InnoDB Cluster Synchronization 35
  76. 76. • Changing these compromize durability! • innodb flush log at trx commit 1: full ACID, default 2: logs written at each commit, flushed per second 0: logs are written and flushed once per second Synchronization 35
  77. 77. • Changing these compromize durability! • innodb flush log at trx commit 1: full ACID, default 2: logs written at each commit, flushed per second 0: logs are written and flushed once per second • Once per second not guaranteed for 0 and 2 DDL can cause faster flushing Scheduling may delay flushing Synchronization 35
  78. 78. • Changing these compromize durability! • innodb flush log at trx commit • sync binlog 0: Synchronization handled by the system 1: At each transaction commit, default No transaction lost N: After N binary log group commits In case of power or OS crash not flushed transactions can be lost Synchronization 35
  79. 79. • table open cache • The number of open tables for all threads • Increase when Connections in the PROCESSLIST are waiting for opening a table Value of global status variable Opened tables is larger than Open tables Table Handlers 36
  80. 80. • table open cache • table definition cache • Size of the cache for table definitions • Increase when Value of Opened table definitions is larger than Open table definitions Table Handlers 36
  81. 81. • table open cache • table definition cache • Increase OS open files limit if needed Table Handlers 36
  82. 82. Query Tuning on the Server Side
  83. 83. • You communicate with database using queries • Even via NoSQL interface • They are not SQL queries, but still queries Heart of the application 38
  84. 84. • You communicate with database using queries • Even via NoSQL interface • They are not SQL queries, but still queries • Data, which you request, matters • 1,000,000,000 rows vs 1 row Heart of the application 38
  85. 85. Query sent Connection Pool: Authentication, Caches; SQL interface; Parser Optimizer Storage engines Hardware Query execution workflow 39
  86. 86. • Selecting a lot of data • SELECT * FROM many columns table You May not Be Able to Change Slow Query 40
  87. 87. • Selecting a lot of data • SELECT * FROM many columns table • Badly written • LEFT JOIN instead of INNER JOIN • Many values in IN() • Retrieving large result set, then discarding • Not effective SQL For particular MySQL version You May not Be Able to Change Slow Query 40
  88. 88. • Selecting a lot of data • SELECT * FROM many columns table • Badly written • LEFT JOIN instead of INNER JOIN • Many values in IN() • Retrieving large result set, then discarding • Not effective SQL For particular MySQL version • We still can improve performance You May not Be Able to Change Slow Query 40
  89. 89. Query Tuning on the Server Side Indexes
  90. 90. SELECT name FROM users SELECT name FROM users WHERE id=12 1 2 5 6 7 9 12 16 18 21 22 23 24 25 Full Table Scan 42
  91. 91. SELECT name FROM users SELECT name FROM users WHERE id=12 1 2 5 6 7 9 12 16 18 21 22 23 24 25 After Index Added 43
  92. 92. d001 d003 d008 d009 d003****** d009****** d008****** d009****** d001****** d003****** d009****** d008****** d009****** d001****** d008****** d008****** d001****** • B-Tree (Mostly) • Fractal Tree • LSM Tree • R-Tree (Spatial) • Hash (Memory SE) • Engine-dependent MySQL Indexes 44
  93. 93. • Single column CREATE INDEX index name ON the table(the column) • Multiple columns CREATE INDEX index name ON the table(column1, column2) How to Create an Index 45
  94. 94. • Single column ALTER TABLE table name ADD INDEX [index name] (the column) • Multiple columns ALTER TABLE table name ADD INDEX [index name] (column1, column2) How to Create an Index 45
  95. 95. • WHERE the column = a value • WHERE the column IN(value1, value2, value3) • WHERE the column LIKE ’value%’ • WHERE the column LIKE ’%value’ When MySQL Uses Indexes: Conditions 46
  96. 96. • WHERE left part = value1 AND right part = value2 • WHERE left part = value1 OR right part = value2 • WHERE right part = value1 AND left part = value2 • WHERE right part = value1 OR left part = value2 When MySQL Uses Indexes: Conditions 46
  97. 97. • table1 JOIN table2 ON table1.column1 = table2.column2 When MySQL Uses Indexes: Joins 47
  98. 98. • table1 JOIN table2 ON table1.column1 = table2.column2 • Same as FROM table1, table2 WHERE table1.column1 = table2.column2 When MySQL Uses Indexes: Joins 47
  99. 99. • GROUP BY the column • GROUP BY left part, right part • GROUP BY right part, left part • GROUP BY the index, another index When MySQL Uses Indexes: GROUP BY 48
  100. 100. • ORDER BY the column • ORDER BY left part, right part • ORDER BY right part, left part • ORDER BY the index, another index When MySQL Uses Indexes: ORDER BY 49
  101. 101. 5.7 ORDER BY left part DESC, right part ASC 8.0 ORDER BY left part DESC, right part ASC • left part must be descending • right part must be ascending • the index(left part DESC, right part ASC) When MySQL Uses Indexes: ORDER BY 49
  102. 102. • Deterministic, built-in • Return same value for the same argument • WHERE the column = FLOOR(123.45) When MySQL Uses Indexes: Expressions 50
  103. 103. • Deterministic, built-in • Return same value for the same argument • WHERE the column = FLOOR(123.45) • Non-deterministic • Return different values for different invocations • WHERE the column = RAND() ∗ 100 When MySQL Uses Indexes: Expressions 50
  104. 104. • Deterministic, built-in • Return same value for the same argument • WHERE the column = FLOOR(123.45) • Non-deterministic • Return different values for different invocations • WHERE the column = RAND() ∗ 100 • Stored functions and UDFs • Indexes are not used Use generated column indexes When MySQL Uses Indexes: Expressions 50
  105. 105. • Identify which queries do not use indexes • Status variables mysql> select * from performance_schema.session_status -> where variable_name in (’Created_tmp_tables’, -> ’Created_tmp_disk_tables’, ’Select_full_join’, -> ’Select_full_range_join’, ’Select_range’, -> ’Select_range_check’, ’Select_scan’, ’Sort_merge_passes’, -> ’Sort_range’, ’Sort_rows’, ’Sort_scan’) and variable_value>0; +------------------------+----------------+ | VARIABLE_NAME | VARIABLE_VALUE | +------------------------+----------------+ | Select_scan | 2 | +------------------------+----------------+ Add Indexes 51
  106. 106. • Identify which queries do not use indexes mysql> show global status like ’Handler_read%’; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | Handler_read_first | 31 | | Handler_read_key | 1909 | | Handler_read_last | 0 | | Handler_read_next | 4393 | | Handler_read_prev | 0 | | Handler_read_rnd | 0 | | Handler_read_rnd_next | 1135 | +-----------------------+-------+ Add Indexes 51
  107. 107. • Identify which queries do not use indexes • PERFORMANCE SCHEMA.EVENTS STATEMENTS * mysql> select * from events_statements_history_long -> where sql_text like ’select count(*) from employees join %’G *************************** 1. row **************************** ... ROWS_SENT: 1 SELECT_RANGE_CHECK: 0 ROWS_EXAMINED: 541058 SELECT_SCAN: 1 CREATED_TMP_DISK_TABLES: 0 SORT_MERGE_PASSES: 0 CREATED_TMP_TABLES: 0 SORT_RANGE: 0 SELECT_FULL_JOIN: 0 SORT_ROWS: 0 SELECT_FULL_RANGE_JOIN: 0 SORT_SCAN: 0 SELECT_RANGE: 0 NO_INDEX_USED: 0 Add Indexes 51
  108. 108. • Identify which queries do not use indexes • Slow query log # Time: 2020-10-11T23:34:03.701871Z # User@Host: root[root] @ localhost [127.0.0.1] Id: 506 # Query_time: 0.024106 Lock_time: 0.000091 Rows_sent: 1 Rows_examined: 1000 SET timestamp=1602459243; SELECT c FROM sbtest1 WHERE id=996; Add Indexes 51
  109. 109. • Identify which queries do not use indexes • QAN in PMM Add Indexes 51
  110. 110. • Identify which queries do not use indexes • Analyze if adding an index will help Add Indexes 51
  111. 111. • Identify which queries do not use indexes • Analyze if adding an index will help • Add the index Add Indexes 51
  112. 112. • Identify which queries do not use indexes • Analyze if adding an index will help • Add the index • Test first! • ADD INDEX is expensive operation Use pt-online-schema-change Add Indexes 51
  113. 113. Query Tuning on the Server Side Optimizer Histograms
  114. 114. • Since version 8.0 Histogram Statistics 53
  115. 115. • Since version 8.0 • Collected and used by the Optimizer Histogram Statistics 53
  116. 116. • Since version 8.0 • Collected and used by the Optimizer • Can be examined in Information Schema mysql> select HISTOGRAM from information_schema.column_statistics -> where table_name=’example’G *************************** 1. row *************************** HISTOGRAM: {"buckets": [[1, 0.6], [2, 0.8], [3, 1.0]], "data-type": "int", "null-values": 0.0, "collation-id": 8, "last-updated": "2018-11-07 09:07:19.791470", "sampling-rate": 1.0, "histogram-type": "singleton", "number-of-buckets-specified": 3} 1 row in set (0.00 sec) Histogram Statistics 53
  117. 117. • Since version 8.0 • Collected and used by the Optimizer • Can be examined in Information Schema • Affects query execution plan, but not access • SELECT ... FROM a JOIN b vs SELECT ... FROM b JOIN a Histogram Statistics 53
  118. 118. • Since version 8.0 • Collected and used by the Optimizer • Can be examined in Information Schema • Affects query execution plan, but not access More details Histogram Statistics 53
  119. 119. 1 2 3 4 5 6 7 8 9 10 0 200 400 600 800 Indexes: Number of Items with Same Value 54
  120. 120. 1 2 3 4 5 6 7 8 9 10 0 200 400 600 800 Indexes: Cardinality 55
  121. 121. 1 2 3 4 5 6 7 8 9 10 0 200 400 600 800 Histograms: Number of Values in Each Bucket 56
  122. 122. 1 2 3 4 5 6 7 8 9 10 0 0.2 0.4 0.6 0.8 1 Histograms: Data in the Histogram 57
  123. 123. • Data distribution is far from uniform • Query accesses two or more tables • Indexes cannot be used • Maintaining them is too expensive • They are already used for different condition Create Histograms 58
  124. 124. Query Tuning on the Server Side Optimizer Configuration
  125. 125. mysql> select @@optimizer_switchG *************************** 1. row *************************** @@optimizer_switch: index_merge=on,index_merge_union=on, index_merge_sort_union=on,index_merge_intersection=on, engine_condition_pushdown=on,index_condition_pushdown=on, mrr=on,mrr_cost_based=on, block_nested_loop=on,batched_key_access=off, materialization=on,semijoin=on,loosescan=on,firstmatch=on, duplicateweedout=on,subquery_materialization_cost_based=on, use_index_extensions=on,condition_fanout_filter=on,derived_merge=on 1 row in set (0,00 sec) Optimizer Switches 60
  126. 126. • Turn ON and OFF particular optimization Optimizer Switches 60
  127. 127. • Turn ON and OFF particular optimization • Can be not helpful • Especially for queries, tuned for previous versions Optimizer Switches 60
  128. 128. • Turn ON and OFF particular optimization • Can be not helpful • Work with them as with any other option • Turn OFF and try SET optimizer_switch = ’use_index_extensions=off’; SELECT ... EXPLAIN SELECT ... Optimizer Switches 60
  129. 129. • Turn ON and OFF particular optimization • Can be not helpful • Work with them as with any other option • If helps implement in queries SELECT /*+ SEMIJOIN(FIRSTMATCH, LOOSESCAN) */ * FROM t1 ...; SELECT /*+ BKA(t1) NO_BKA(t2) */ * FROM t1 INNER JOIN t2 WHERE ...; Optimizer Switches 60
  130. 130. • Temporary tables • tmp table size • max heap table size • default tmp storage engine Increase Size of Optimizer Temporary Objects 61
  131. 131. • Temporary tables • Buffers for query execution • join buffer size JOIN conditions, not using indexes Increase Size of Optimizer Temporary Objects 61
  132. 132. • Temporary tables • Buffers for query execution • join buffer size • read buffer size Caching indexes for ORDER BY Bulk insert into partitions Caching result of nesting queries Increase Size of Optimizer Temporary Objects 61
  133. 133. • Temporary tables • Buffers for query execution • join buffer size • read buffer size • read rnd buffer size Multi-Range Read optimization Increase Size of Optimizer Temporary Objects 61
  134. 134. • Temporary tables • Buffers for query execution • join buffer size • read buffer size • read rnd buffer size • select into buffer size SEELCT INTO OUTFILE SEELCT INTO DUMPFILE Increase Size of Optimizer Temporary Objects 61
  135. 135. • Temporary tables • Buffers for query execution • join buffer size • read buffer size • read rnd buffer size • select into buffer size • sort buffer size ORDER BY GROUP BY Increase Size of Optimizer Temporary Objects 61
  136. 136. • Temporary tables • Buffers for query execution • join buffer size • read buffer size • read rnd buffer size • select into buffer size • sort buffer size • Change only at the session level! Increase Size of Optimizer Temporary Objects 61
  137. 137. • Hardware RAM: more is better Disk: SSD or NVMe CPU: more cores, better concurrency Net: highest speed possible Conclusion 62
  138. 138. • Hardware • Configuration • InnoDB innodb buffer pool size innodb log file size innodb thread concurrency innodb io capacity innodb flush method innodb flush log at trx commit • Server sync binlog table open cache table definition cache Conclusion 62
  139. 139. • Hardware • Configuration • Query Performance • Add indexes, histograms • Tune Optimizer • Adjust Optimization buffers tmp table size join buffer size read buffer size read rnd buffer size select into buffer size sort buffer size Conclusion 62
  140. 140. Troubleshooting hardware resource usage Troubleshooting configuration issues MySQL Query Tuning for DevOps Percona Monitoring and Management Percona Kubernetes Operators More information 63
  141. 141. www.slideshare.net/SvetaSmirnova twitter.com/svetsmirnova github.com/svetasmirnova Thank you! 64

×