Error establishing a database connection
-
A quiz on my site has proven very popular and if too many people take it together, it causes database errors. My hosting company have looked into it and this is their advice:
“The issue is actually your database queries. There are lots of queries like the one below that are running. Each one takes over a minute so you quickly hit mysql max connections. Ask your developer to optimise the query – reduce the data set or remove the join or add appropriate indexes.”
SELECT
SUM(s.points) AS points,
SUM(q.points * (s.correct_count + s.incorrect_count)) AS g_points
FROM
pjwy_wp_pro_quiz_statistic_ref AS sf
INNER JOIN pjwy_wp_pro_quiz_statistic AS s ON ( s.statistic_ref_id = sf.statistic_ref_id )
INNER JOIN pjwy_wp_pro_quiz_question AS q ON ( q.id = s.question_id )
WHERE
sf.quiz_id = 1I am out of my depth here…. any advice please?
- The topic ‘Error establishing a database connection’ is closed to new replies.