php - A website running online, how to check whether which sql statement needs optimization?
天蓬老师
天蓬老师 2017-06-05 11:07:52
0
5
686

For example, if a website is running online and it is found that a certain page loads very slowly, how to check whether which SQL statement needs to be optimized

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(5)
淡淡烟草味

Slow query log.

左手右手慢动作

Check the log and find the corresponding sql desc or explain select....(your sql statement) to check the efficiency, or write the execution efficiency directly to the log

巴扎黑

If it is Laravel, you can use debugbar https://github.com/barryvdh/l...

黄舟

In the configuration of mysql, enable slow query slow_query_log and statement without index log_queries_not_using_indexes. You can use the explain + sql statement to check the execution efficiency of sql.

You should also pay attention to whether it can be optimized in the program. Don't put database queries in loops.

PHPzhong

Have you used a framework? You can monitor the running time of each SQL. And record the logs and analyze them one by one.

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