The Drupal 7 site we've produced is intermittently experiencing slowdown on page load. Using Devel I've pinpointed the slow down to queries generated by two similar Views and the SQL generated.

The query usually runs in less than 20ms but intermittently, perhaps every hour or two will hang causing the same queries to run in 3-4 seconds each. It will continue to run mostly slowly for maybe 15mins before returning to normal. I have site caching disabled whilst I debug. Even without caching it's lightening fast when running ok.

Below is one of the queries. Could anyone please shed any light on what might be causing this delay? Many thanks.

 SELECT webform_views_leave_a_comment_17.club_code AS
 webform_views_leave_a_comment_17.subject AS
 webform_views_leave_a_comment_17.comment_average AS
 webform_views_leave_a_comment_17.comment AS
 file_managed_webform_views_leave_a_comment_17.filename AS
 webform_views_leave_a_comment_17.course AS
 webform_views_leave_a_comment_17.greens AS
 webform_views_leave_a_comment_17.facilities AS
 webform_views_leave_a_comment_17.hospitality AS
 webform_views_leave_a_comment_17.comment_date AS
 webform_views_leave_a_comment_17.comment_username AS
 webform_views_leave_a_comment_17.value AS
 webform_views_leave_a_comment_17.club_reply AS
 webform_views_leave_a_comment_17_club_reply FROM webform_submissions
 webform_submissions LEFT JOIN webform_views_leave_a_comment_17
 webform_views_leave_a_comment_17 ON webform_submissions.sid =
 webform_views_leave_a_comment_17.sid INNER JOIN webform_submissions
 webform_submissions_webform_views_leave_a_comment_17 ON
 webform_views_leave_a_comment_17.sid =
 webform_submissions_webform_views_leave_a_comment_17.sid LEFT JOIN
 file_managed file_managed_webform_views_leave_a_comment_17 ON
 webform_views_leave_a_comment_17.upload_image =
 file_managed_webform_views_leave_a_comment_17.fid LEFT JOIN node node
 ON webform_submissions.nid = node.nid WHERE ((
 (webform_views_leave_a_comment_17.club_code =
 :db_condition_placeholder_0) )AND(( (node.title LIKE
 :db_condition_placeholder_1 ESCAPE '\\') AND
 (webform_views_leave_a_comment_17.comment_status LIKE
 :db_condition_placeholder_2 ESCAPE '\\') ))) LIMIT 25 OFFSET 0
  • Run explain on the view query. Also check out the database tips in my presentation goo.gl/30yi39 – mikeytown2 Jun 23 '14 at 15:43
  • are you sure it's not a server problem? if the problem persists for 15 min or so at a time, when it starts, try immediately running that query via phpMyAdmin or similar. – Geoff Jun 23 '14 at 16:08
  • Thanks guys. Is 'explain' a drupal thing or phpMyAdmin please? What would it likely show me? – James Jun 24 '14 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.