catalyst / moodle-tool_objectfs

Object file storage system for Moodle
https://moodle.org/plugins/tool_objectfs
88 stars 72 forks source link

Improve populate_objects_filesize performance by limiting db results #559

Closed sammarshallou closed 1 year ago

sammarshallou commented 1 year ago

I have been investigating an issue with populate_objects_filesize task - you already fixed the main issue (that it never finishes) by correcting the join, however as well as not finishing, we noticed it seemed to use a large amount of database storage, with associated costs.

Partially this might just be because it's a big query, but some of it might be related to the fact that it queries the entire results, then uses only the first $maxresults of them. Although this is a recordset I suspect it will still read more than it needs, so I added in a liimit.

I have applied this change to our local copy and it appears to still work, i.e. on our test server everything that should have a filesize now does. To be honest from our point of view we don't mind if you put this change in because we will have finished running the task before we next update from your codebase, but I thought I would submit just in case it's useful to others.

danmarsden commented 1 year ago

Thanks @sammarshallou - makes sense to me - merged it in to help the next person needing this!