It's been found that the following SQL is smashing DB when minduplicates is set to 5:
SELECT contenthash, COUNT(contenthash)
FROM mdl_files
WHERE filearea <> ? AND (filearea <> ? OR component <> ?)
GROUP BY contenthash
HAVING COUNT(contenthash) >= $1
It's been found that the following SQL is smashing DB when
minduplicatesis set to 5: