Jump to content

Detecting a long MySQL query


benholness

Recommended Posts

Hi,

 

I have a website that occasionally gets stuck when particular queries are run. The queries are big, selecting and left joining over 30 million plus rows of data and sometimes take 60-120 seconds to run. The system comprises of four satellite servers replicating one master db.

 

I would like to be able to detect a long query while it is happening, so that any queries made while that one is running are redirected to one of the satellite servers.

 

Are there any known methods of achieving this, or will I need to (for example) write to a file the timestamp and details of all queries running to determine if a long query is in progress?

 

Cheers,

 

Ben

Link to comment
https://forums.phpfreaks.com/topic/164558-detecting-a-long-mysql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.