Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Getting started with mysqlsla

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. What is mysqlsla?

To put it simply, it is a tool to analyze mysql log, and I mainly use it to analyze mysql slow log.

2. Download

Http://hackmysql.com/mysqlsla

3. Installation

Tar

Cd

Perl Makefile.PL

Make & & make install

4. Run

Mysqlsla-lt slow / tmp/slow.log

This parameter is used to determine the type of log, mainly slow, general, binary, msl, udl, and slow when analyzing slow log. )

At this point, the following error message may appear:

The solution is as follows:

Yum install perl-Time-HiRes

The following error may also occur, and the method is also in the red box in the figure

Another possibility of error is as follows, and the method is also shown in the figure.

This is ok! Since I don't have the data here, I'll show you the performance when it's empty.

5. Command parameter description

1)-log-type (- lt) type logs:

This parameter is used to determine the type of log, mainly slow, general, binary, msl, udl, and slow when analyzing slow log.

2)-sort:

Determine what parameters are used to sort the analysis results, which is sorted by t_sum by default.

T_sum: sort by total time

C_sum: sort by total number

C_sum_p: the percentage of the total number of times the sql statement was executed.

3)-top:

Displays the number of sql. The default is 10, indicating how many items are sorted by rule.

4)-statement-filter (- sf) [+ -] [TYPE]:

Filter the types of sql statements, such as select, update, drop.

[TYPE] there are SELECT, CREATE, DROP, UPDATE, INSERT, such as "+ SELECT,INSERT". If it does not appear, the default is -, that is, not included.

5) db: the log of which library to process:

For example, take only the select statement of the backup library and the first two records sorted by c_sum_p

Mysqlsla-lt slow-sort c_sum_p-sf "+ select"-db backup-top 2 / tmp/127_slow.log

6. Description of statistical parameters (http://www.jb51.net/article/29769.htm)

1) queries total: total number of queries

2) unique: the number of sql after weight removal

3) sorted by: output the slow sql statistics with the most significant ranking of the contents of the report, including average execution time, waiting lock time, total number of resulting rows, and total number of rows scanned.

(t_sum: sort by total time; c_sum: sort by total number of times; c_sum_p: number of sql statements executed as a percentage of total number of times executed)

4) Count: the number of times sql is executed and its percentage in the total number of slow log.

5) Time: execution time, including total time, average time, minimum time, maximum time, as a percentage of total slow sql time.

6) 95% of Time: removal of the fastest and slowest sql, coverage accounts for 95% of the sql execution time.

7) Lock Time: the time to wait for the lock.

8) 95% of Lock: 95% slow sql waiting time for lock.

9) Rows sent: the number of resulting rows, including average, minimum, and maximum.

10) Rows examined: the number of rows scanned.

11) Database: which database does it belong to?

12) Users: which user, IP, accounts for the percentage of sql executed by all users.

13) Query abstract: abstract sql statement.

14) Query sample: sql statement.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report