A
A
Alexey Nikolaev2018-03-01 22:40:01
SQL
Alexey Nikolaev, 2018-03-01 22:40:01

How to understand which sql queries load the processor?

Good evening.
The situation is banal - the site uses 90% of the CPU under light load, suspicion of the database, because it is written crookedly. How to detect the place where the most expensive / frequent queries to the database are located? File, statistics table, or specific query. Are there tools that will allow you to do this?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Skibin, 2018-03-02
@Heian

First, look at htop to see if it's really a database.
In the case of mysql, you can log slow queries via my.cnf https://dev.mysql.com/doc/refman/5.7/en/slow-query...
In the case of postgresql - https://www.heatware. net/databases/how-to-find-log...

R
res2001, 2018-03-01
@res2001

Just a suspicion?
Need to be more precise.
If on Linux, then look in the top what loads the percent, if Windows is a task manager.
Naturally, there are tools for profiling the database, you just need to know which database server you are using - each has its own tool.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question