I have a moodle 1.9.3 with a mysql grade_grades table of 1.188.739 rows and grade_items of 2.307 and I see a lot of queries like this:
SELECT DISTINCT go.userid FROM mdl_grade_grades go
JOIN mdl_grade_items gi ON gi.id = go.itemid
LEFT OUTER JOIN mdl_grade_grades g ON (g.userid = go.userid AND g.itemid = 1769)
WHERE gi.id <> 1769 AND g.id IS NULL;
that take around 30 seconds or more to execute.
This is blocking the tables grade_grades and grade_items and slowing a lot my moodle.
There is a way to getting it runnning more faster?
By the way the query is in the function compute of lib/grade/grade_item.php
// precreate grades - we need them to exist
$sql = "SELECT DISTINCT go.userid
FROM {$CFG->prefix}grade_grades go
JOIN {$CFG->prefix}grade_items gi
ON gi.id = go.itemid
LEFT OUTER JOIN {$CFG->prefix}grade_grades g
ON (g.userid = go.userid AND g.itemid = $this->id)
WHERE gi.id <> $this->id AND g.id IS NULL";
Hello, Wilson
maybe you are seeing this problem:
http://moodle.org/mod/forum/discuss.php?d=110752#p515709
maybe you are seeing this problem:
http://moodle.org/mod/forum/discuss.php?d=110752#p515709
Thanks Daniel, I read your link and I think that my problem is a bug in gradebook that creates too much rows http://tracker.moodle.org/browse/MDL-16785
Now I'm looking a way to repair it with the minimum downtime for my users, any idea about it?
Now I'm looking a way to repair it with the minimum downtime for my users, any idea about it?