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

Example Analysis of MySQL slow query Log not printed

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is to share with you the content of the example analysis that the MySQL slow query log is not printed. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Test environment modifies long_query_time=0.2

The slow query log does not take effect when executing the following query

Mysql > select sleep (5)

+-+

| | sleep (5) | |

+-+

| | 0 |

+-+

1 row in set (5.00 sec)

⑴ then checks the parameters

Mysql > show variables like'% query%'

+-+ +

| | Variable_name | Value |

+-+ +

| | binlog_rows_query_log_events | OFF |

| | ft_query_expansion_limit | 20 |

| | have_query_cache | YES |

| | long_query_time | 1.000000 | |

| | query_alloc_block_size | 8192 | |

| | query_cache_limit | 0 | |

| | query_cache_min_res_unit | 4096 | |

| | query_cache_size | 0 | |

| | query_cache_type | OFF |

| | query_cache_wlock_invalidate | OFF |

| | query_prealloc_size | 8192 | |

| | slow_query_log | ON |

| | slow_query_log_file | / mlogs/slow1.log |

+-+ +

Found that the configuration is normal.

⑵ then checks the following two parameters

Min_examined_row_limit 、 long-queries-not-using-indexes

Mysql > show variables like 'min_examined_ro%'

+-+ +

| | Variable_name | Value |

+-+ +

| | min_examined_row_limit | 10 | |

+-+ +

1 row in set (0.00 sec)

Mysql > show variables like 'log_queries_not_using_indexes'

+-+ +

| | Variable_name | Value |

+-+ +

| | log_queries_not_using_indexes | OFF |

+-+ +

Then set min_examined_row_limit to 0, and the slow query will record

Two parameters:

Log_queries_not_using_indexes, a query that indicates that the record does not use the index when on, even if it does not exceed the long_query_time

Min_examined_row_limit, which means to record as many queries as possible (when min_examined_row_limit=on)

Reason: select sleep (5) statement query has no record (that is,

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