mysql 查询语句性能分析
PHPz
PHPz 2017-04-17 13:05:47
0
6
692

有什么工具可以分析记录 一条查询语句吗?比如说在那条语句中,查询哪个字段用时最多。

PHPz
PHPz

学习是最好的投资!

reply all(6)
PHPzhong

Records stored in mysql are generally not divided into fields and are stored as a whole.
Tools for optimizing SQL include: explain: used to analyze whether to apply indexes and the number of scanned records; slow log generally records SQL statements whose execution time is greater than a certain value; show profiles generally analyzes data on IO, Memory, CPU, etc.

洪涛

Use execution plan, explain

迷茫

Set in my.cnf

php[mysqld] 
slow_query_log=on 
slow_query_log_file=mysql-slow

Slow query log analysis tool officially provided by mysqlmysqldumpslow mysql-slow
Also mysqlsla

阿神

Use explain command

小葫芦

Must explain

伊谢尔伦

It is recommended to use Alibaba's druid database connection pool. Configure it to record all SQL execution statistics for a period of time. There will be a web page that can be accessed, which is very helpful for SQL execution analysis. However, the cache of this thing takes up a lot of space, and it cannot count long-term running conditions. It is very suitable for analyzing the amount of data for several hours.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template