Hi from Brazil again!
After some improvements on infrastructure, we have identified some SQL queries that could be a real performance problem on one of our Moodle installations - sometimes it takes more than 4 minutes to execute. This issue has been discussed here: http://moodle.org/mod/forum/discuss.php?d=110752&parent=515709 and the SQL is:
SELECT DISTINCT go.userid FROM grade_grades go JOIN grade_items gi ON gi.id = go.itemid LEFT OUTER JOIN grade_grades g ON (g.userid = go.userid AND g.itemid = 4965) WHERE gi.id <> 4965 AND g.id IS NULL;
According to Taylor Judd, the table mdl_grade_grades is populated with 1000s of superfluous data when there is a custom calculation formula to obtain the final grades - and we discovered that this calculation is executed more times than we thought.
We want to know if someone has faced this same problem and how have identified the rows that are superfluous to delete?
Until this problem is fixed, we could create a step on cron.php to delete these data.
I forgot to say: we use Moodle 1.9.2, PHP 5.1.6 and PostgreSQL 8.1.11 on a Linux Ubuntu Server (Intel QuadCore with 4GB RAM).