Queries taking 5+ sec, how to debug?

Our PHP log shows a lot of slow requests, which are direct queries on manticore via mysqli_query().
This function call takes 5+ seconds.

There is nothing in the manticore logs. Is there any way to debug to know what could be the bottleneck here?

These documentation sections may be helpful:

Other than that what helps a lot usually is:

  • identifying a slow query
  • making sure it’s slow by running it manually outside the application (e.g. via linux mysql client)
  • checking what the bottleneck is in terms of system resources: disk or cpu. You can use vmstat/dstat for that while running the slow query in a loop.

The big problem is that I dont know which queries are slow, we have milions running.

How can I log a slow query, is there an option in Manticore (like the slow_query_log in mysql?)

While there isnt a dedicated ‘slow’ log, the normal query log can be used
https://manual.manticoresearch.com/Server_settings/Searchd#query_log
The total time for the query is logged.

Can filter that manually (with awk or similar) to just get slow queries.

Or can in fact specify a minimum time
https://manual.manticoresearch.com/Server_settings/Searchd#query_log_min_msec
so that only slower queries are logged.

thx, exactly what I needed!