moodle-tool_objectfs icon indicating copy to clipboard operation
moodle-tool_objectfs copied to clipboard

Performance - SQL redundant condition?

Open egiles opened this issue 6 years ago • 3 comments

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).

egiles avatar Sep 27 '18 00:09 egiles

Marking this as nofix. There are cases where there are differences so the max is required

mattporritt avatar Oct 15 '18 06:10 mattporritt

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.

image

dmitriim avatar Jun 04 '19 21:06 dmitriim

This one query accounts for almost half the load on average on my entire LMS database server:

image

Query plan shows massive table scans even when nothing is returned and takes over 4 seconds to run:

image

TrueBurn avatar Jun 22 '22 12:06 TrueBurn