My question on slow mysql performance was closed as off-topic:
Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow.
At this point it is not clear the database performance is slow because of an application/programming problem (so Stack Overflow), or misconfiguration of mysql (ServerFault?). Rick James, especially, was providing some excellent advice until the question was closed.
If, indeed, the question is better on Stack Overflow, could someone kindly move it there?
Otherwise, four minutes for an mysql query is a serious problem for us and we're searching hard for a solution.