moodle-tool_objectfs
moodle-tool_objectfs copied to clipboard
Performance - SQL redundant condition?
Some of the SQL also have MAX(filesize).
Why is this there when file sizes should always match the contenthash? To make it easier to find collisions? If not its additional processing (sorry to split hairs).
Marking this as nofix. There are cases where there are differences so the max is required
I'd like to reopen this issue as this actually have a great impact on the systems with a huge number of files in files tables. See DB average CPU usage before and after enabling tasks with these queries. It's like +20% to avg CPU usage.
This one query accounts for almost half the load on average on my entire LMS database server:
Query plan shows massive table scans even when nothing is returned and takes over 4 seconds to run: