Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6815

Course backup/restore takes (nearly) forever

$
0
0
by Alberto AD.  

Hello everyone
We have a serious problem with course duplication: the processing time is really long, it can take even more than 30 minutes: in the attached photo, 36 minutes and zero hope to see the end. Obviously it is not a sustainable situation.

From what I understand, the problem is related to the question banks, whose use has not been exactly "clean" by colleagues.
It seems that, by duplicating a course with a quiz and at least one question bank INTERNAL to the course (and not system), the question bank is also duplicated. In many cases, courses of different types have been duplicated for speed, and so now we have an endless amount of questions and versions:

- We have over 440,000 versions of questions, all with "ready" status on mdl_question_versions

- We have over 440 thousand questions, of which over 370,000 are "random" which, apparently, are now managed differently by Moodle.

Is the problem of slow copying really related to the question banks, even if I duplicate courses with only system question banks and not related to the course?

In this case, how can I solve it? We tried to eliminate many unused questions, but to avoid errors you always have to enter the question bank of the individual courses and the operation is very slow.

If the problem is the question bank, I've found this thread:

https://moodle.org/mod/forum/discuss.php?d=455245

This 2 queries return 0 rows:

SELECT *
FROM mdl_question_attempts qa
JOIN mdl_question q ON q.id = qa.questionid
WHERE q.qtype = 'random'
SELECT *
FROM mdl_question_references qr
JOIN mdl_question_versions qv ON qv.questionbankentryid = qr.questionbankentryid
JOIN mdl_question q ON q.id = qv.questionid
WHERE q.qtype = 'random'

Can I safely delete with these?

DELETE FROM mdl_question_bank_entries
WHERE id IN (
SELECT qv.questionbankentryid
FROM mdl_question_versions qv
JOIN mdl_question q ON q.id = qv.questionid
WHERE q.qtype = 'random'
)

DELETE FROM mdl_question_versions qv
WHERE questionid IN (
SELECT id FROM mdl_question q WHERE q.qtype = 'random'
)

DELETE FROM mdl_question WHERE qtype = 'random'

If not, How can I troubleshoot my problem?

Thanks in advance

PS: We have the same problem even if we use the normal backup and restore inside "course reuse".

Inside task log, We have 

2741582 reads
8667 writes

Our moodle is:

Moodle 4.5.1+ (Build: 20241219)

Ubuntu as server

mysql (8.0.40-0ubuntu0.22.04.1)    

php 8.2.27

everything is green and ok in Environment

cron runs every 1 minute


Viewing all articles
Browse latest Browse all 6815

Trending Articles