Related Blogs
Introduction to Kibana
Aug 1, 2020, 6:19:45 PM | Anurag Srivastava
Bucket Aggregation in Elasticsearch
Aug 29, 2018, 7:15:06 PM | Anurag Srivastava
Metrics Aggregations in Elasticsearch
Aug 18, 2018, 6:02:20 PM | Anurag Srivastava
Introduction to Elasticsearch Aggregations
Aug 14, 2018, 4:47:56 PM | Anurag Srivastava
Wildcard and Boolean Search in Elasticsearch
Aug 10, 2018, 7:14:40 PM | Anurag Srivastava
Basics of Data Search in Elasticsearch
Aug 4, 2018, 7:02:21 AM | Anurag Srivastava
Top Blogs
Wildcard and Boolean Search in Elasticsearch
Aug 10, 2018, 7:14:40 PM | Anurag Srivastava
Elasticsearch REST APIs
Jul 31, 2018, 6:16:42 PM | Anurag Srivastava
How to count number of words in a HTML string and find Read time in Python 3
Jun 30, 2018, 12:07:47 PM | jitender yadav
Create a Chess board in PHP
Mar 9, 2020, 8:45:41 AM | Rocky Paul
Bucket Aggregation in Elasticsearch
Aug 29, 2018, 7:15:06 PM | Anurag Srivastava
Metrics Aggregations in Elasticsearch
Aug 18, 2018, 6:02:20 PM | Anurag Srivastava
Answers
Anurag Srivastava
Oct 3, 2020, 10:15:12 AM | Share- Facebook
- Twitter
- WhatsApp
- Linkedin
- Copy Link
We have various tools which we can use to improve the MySQL performance, some of them are as follows:
Explain Query
EXPLAIN is one of the most powerful tools for understanding and optimizing troublesome MySQL queries. We can type explain before a query to get the insight of the query.
Performance_Schema (MySQL 5.5+)
Performance Schema provides the user with an insight into the scene picture of MySQL. It was introduced in MySQL version 5.5 with the introduction of a new storage engine 'Performance Schema' and a new database named 'Performance Schema'. It provides us a SQL user interface to get the insight.
Performance Schema has many instruments to monitor the activities. It has a tree-like structure separated by '/' where when we move from left to right it moves from more generic to more specific:
There are more than 1000 instruments in MySQL 5.7 which are stored in performance_schema.setup_instruments table. For example, if we want to know the slow queries which are taking too long to load, we can run the following query:
MySQL sys Schema (MySQL 5.7.7+)
MySQL sys schema has a set of objects that helps us to interpret data collected by the Performance Schema. It converts the performance schema results in a more meaningful way which is easy to understand.
Like if I want to find out all unused indexes:
Here we can get queries with errors or warnings:
pt-query-digest (Percona Toolkit)
pt-query-digest is a command-line tool from Percona Toolkit. It is used to analyze MySQL queries from logs, process-list, and tcpdump. It has a powerful filtering capability and can take input from multiple sources like slow query log, general query log, tcpdump, binary log, and process list, etc and can create the report through which we can take decisions.
pt-index-usage (Percona Toolkit)
It read queries from a log file and analyze how they use indexes. This tool can connect to a MySQL database server, reads through a query log, and uses EXPLAIN to ask MySQL how it will use each query. Once this process is done it prints out a report on indexes and lists those queries which are not using indexes.
mysqltuner
MySQLTuner is a script file that is written in Perl and allows us to review a MySQL installation. It makes adjustments to increase the performance and stability of the MySQL server. Configuration variables and status data is fetched through
MySQLTuner script. After accessing these details it presents a brief detail about the setup along with some basic performance suggestions. These suggestions are quite handy and can help us to quickly fix some of the issues in practically no time.
If you want to learn more then please refer my two blogs on MySQL performance:
If you have any further queries then please let me know.