phdphd Posted September 14, 2014 Share Posted September 14, 2014 Hi All,I have a form that enables the user to know events that occur in a specific city. Most of the time they get the results in a few seconds, despite the fact that many rows in various tables might be searched for detailed infos about the events in that city.However, this form partly relies on a table against which a MySQL event regularly does some operations. If the user uses the form while the event is being executed, they have to wait up to 30 seconds before getting the results, and sometimes only part of the html page is generated.Is there a way to avoid this lengthy waiting time ?I am wondering whether or not the best would be putting the site on maintenance while the event is being executed, with a "please come back in a few minutes" message.Thanks in advance for your help. Link to comment https://forums.phpfreaks.com/topic/291059-slow-query-runningpage-rendering-while-mysql-event-is-being-executed/ Share on other sites More sharing options...
Barand Posted September 14, 2014 Share Posted September 14, 2014 Is there a way to avoid this lengthy waiting time ? Possibly. From the information that you have given us I am sure any of the psychics on the forum could help. Link to comment https://forums.phpfreaks.com/topic/291059-slow-query-runningpage-rendering-while-mysql-event-is-being-executed/#findComment-1491104 Share on other sites More sharing options...
CroNiX Posted September 15, 2014 Share Posted September 15, 2014 The best thing you can do to speed up queries is to have the fields that are being JOINed ON, ORDERed BY, GROUPed BY, or used in a WHERE, properly indexed. Also learning to use EXPLAIN will help see where the bottlenecks are. http://www.sitepoint.com/optimizing-mysql-indexes/ Link to comment https://forums.phpfreaks.com/topic/291059-slow-query-runningpage-rendering-while-mysql-event-is-being-executed/#findComment-1491188 Share on other sites More sharing options...
Barand Posted September 15, 2014 Share Posted September 15, 2014 As well as the table structure the query syntax used can also affect performance and, for all we know, you could be running multiple queries inside loops. You have given us absolutely no information for us to help you. Link to comment https://forums.phpfreaks.com/topic/291059-slow-query-runningpage-rendering-while-mysql-event-is-being-executed/#findComment-1491189 Share on other sites More sharing options...
phdphd Posted September 21, 2014 Author Share Posted September 21, 2014 Thanks for your answers. Link to comment https://forums.phpfreaks.com/topic/291059-slow-query-runningpage-rendering-while-mysql-event-is-being-executed/#findComment-1491707 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.