Sometimes the webserver I develop faced crashing due to some sql running a long long time i.e. running 30 minutes. Not very often. Once in two years. I don't want to turn on mysql long query log function. I want to develop code to log such sql if running without return from mysql.
I am thinking that I log the sql before sending to the sql server with a datetime stamp. If the sql query finished running on sql server and return to my code, I will deleted the sql record in my bookkeeping. I might face multiple same sql statement submit to the server, I think that I don't care the order to delete the sql as long as they runs very quickly, not the trouble making sql.
What data structure should I use? I think that array might not fit the bill, as I need to do bookkeeping about finding the empty cell to fill in and remove the sql in the cell.
My boss said no. He said that timeout might affect mysql database replication. I asked him to clarify it. And he said only as temporary solution using timeout. I still need to solve my original question.
My boss turned off mysql database log. The server is very busy and the server generates lots of database log. It is outside of my control. My boss is the database admin.