Jump to content

Slow Query Running/Page Rendering While MySQL Event Is Being Executed


phdphd

Recommended Posts

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.
 

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/

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.

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.