DBA’s essential guide: Solving slow database queries

For a DBA, his ability can be seen from the stability of the company's database system. An excellent DBA must not only ensure the stable operation of the database, but also need to be able to effectively deal with various sudden performance problems of the database, and the last A common performance problem is slow queries.

Our company is relatively large, with more than 100 database instances for large and small projects. The important task of ensuring the stable operation of these databases rests with me. I need to troubleshoot all problems one by one every day. This is a task. It is a very arduous task, and it is common for mistakes to happen. The impact is not big. If it involves corporate interests, then pray that the next company does not have so many databases.

too difficult

Since there are many slow query problems in each database instance, it is obviously unrealistic to rely on my own human resources to troubleshoot. After trying many automated tools, I finally found a tool that perfectly solved my problem: NineData Slow query analysis function. It can automatically collect and record all slow queries in the database. What is more eye-catching is that it performs performance diagnosis on each slow query and finally provides optimization suggestions, including adding or modifying indexes, adjusting table structures, etc. , and can also provide optimization suggestions based on business needs. Type configure SQL development specifications. After the configuration is completed, the system will also diagnose slow SQL based on these specifications.

Without further ado, let’s go straight to the picture.

Slow query trend chart

This is a slow query trend chart for a single data source dimension. First, you can see the total number of slow queries within a time range, and then you can clearly see that a lot of slow queries were generated on December 8. You can see it by hovering the mouse over the curve. Details.

NineData slow query trend chart

Slow query statistics

Displays detailed information on all slow queries generated by the database at a certain stage. SQL template represents a SQL framework that does not contain specific parameters. All slow queries using the same SQL template will be recorded under a template. Expand the template to see all slow SQL statements. The information contained is also very rich, such as execution time, query time, user executing the query, host name, etc.

NineData slow query statistics

Diagnosis optimization

Conduct performance diagnosis for slow query SQL statements. The results of performance diagnosis include long execution time, low effective reads, high waiting time ratio, low cache hit rate, etc.; standard review is based on the SQL development specifications configured by the administrator. Statements are reviewed; index recommendations are provided based on the CBO cost model to help DBAs easily optimize database performance.

NineData diagnostic optimization

For me, this tool is like a blessing after a long drought. It has all the functions that a DBA needs. People like me, who work overtime until after 22 o'clock every day, have recently begun to get off work on time.

Start getting off work on time

the latest update

Just recently, they released data dashboard and report download functions for slow query analysis functions.

As mentioned before, the company has more than 100 database instances, and each instance has a large number of slow queries... So here comes the problem. If I want to manage slow queries, I need to open the data sources one by one and find the ones that need to be managed. It is very laborious to manage data sources, and this data market is the finishing touch!

Slow query market

Supports viewing by data source, environment, label, and data source type. It is clear at a glance which data source generates the most slow queries.

NineData slow query market

TOP 100 data sources

The top 100 data sources with the largest number of slow queries are displayed from high to low. Click on the details to quickly enter the slow query page of the data source for management, which is very convenient.

NineData displays TOP 100 data sources

Report download

This function is very useful when I need to submit optimization requirements to developers. In the data source slow query details page, all slow SQLs in the target time period can be integrated into a PDF document, which contains all the details that need to be corrected. , so that developers can compare and optimize.

NineData generates slow SQL report download

postscript

Since using this tool, I come to the company every morning, make a cup of coffee slowly, then turn on the computer and log in to NineData's console to check the slow query report of the previous day. After a few minutes, I have a comprehensive understanding of our company's database. After a few days of overall status, you can directly invest in more core rectification work, instead of spending a lot of time and energy to troubleshoot problems as before, and the work efficiency is greatly improved.

The most important thing is that this tool is very reliable. After several days of use, nothing was missed. Every tiny point will be captured and presented by it. The boss no longer has to spend huge sums of money to recruit N DBAs to deal with these. Question, finally no more questions.

IntelliJ IDEA 2023.3 & JetBrains Family Bucket annual major version update new concept "defensive programming": make yourself a stable job GitHub.com runs more than 1,200 MySQL hosts, how to seamlessly upgrade to 8.0? Stephen Chow's Web3 team will launch an independent App next month. Will Firefox be eliminated? Visual Studio Code 1.85 released, floating window Yu Chengdong: Huawei will launch disruptive products next year and rewrite the history of the industry. The US CISA recommends abandoning C/C++ to eliminate memory security vulnerabilities. TIOBE December: C# is expected to become the programming language of the year. A paper written by Lei Jun 30 years ago : "Principle and Design of Computer Virus Determination Expert System"
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/ninedata/blog/10321091