log_slow_extra输出的额外字段

时间:2019-01-18
本文章向大家介绍log_slow_extra输出的额外字段,主要包括log_slow_extra输出的额外字段使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

启用log_slow_extra系统变量(从MySQL 8.0.14开始可用)会导致服务器将以下额外字段写入文件输出(不影响表输出)。一些字段描述引用状态变量名。有关更多信息,请参阅状态变量描述。但是,在慢速查询日志中,计数器是每个语句的值,而不是每个会话的累积值。
Thread_id: ID

The statement thread identifier.

Errno: error_number

The statement error number, or 0 if no error occurred.

Killed: N

If the statement was terminated, the error number indicating why, or 0 if the statement terminated normally.

Bytes_received: N

The Bytes_received value for the statement.

Bytes_sent: N

The Bytes_sent value for the statement.

Read_first: N

The Handler_read_first value for the statement.

Read_last: N

The Handler_read_last value for the statement.

Read_key: N

The Handler_read_key value for the statement.

Read_next: N

The Handler_read_next value for the statement.

Read_prev: N

The Handler_read_prev value for the statement.

Read_rnd: N

The Handler_read_rnd value for the statement.

Read_rnd_next: N

The Handler_read_rnd_next value for the statement.

Sort_merge_passes: N

The Sort_merge_passes value for the statement.

Sort_range_count: N

The Sort_range value for the statement.

Sort_rows: N

The Sort_rows value for the statement.

Sort_scan_count: N

The Sort_scan value for the statement.

Created_tmp_disk_tables: N

The Created_tmp_disk_tables value for the statement.

Created_tmp_tables: N

The Created_tmp_tables value for the statement.

Start: timestamp

The statement execution start time.

End: timestamp

The statement execution end time.
给定的慢速查询日志文件可能包含通过启用log_slow_extra而添加或不添加额外字段的行组合。日志文件分析器可以通过字段计数确定一行中是否包含其他字段。

写入慢速查询日志文件的每个语句前面都有一个SET语句,其中包含一个时间戳。在MySQL 8.0.14中,时间戳表示慢语句开始执行的时间。在8.0.14之前,时间戳指示记录慢速语句的时间(发生在语句完成执行之后)。