There are cases when the total number of files fetched using the current get_media_files method can number 100,000 plus. Loading this amount of records into memory can heavily impact page load times.
The solution is to add an additional filter for the filepath so only the records relating for the file being loaded, is loaded into memory. This should never exceed a dozen.
The SQL is still able to take advantage of the existing index made up of fields contextid, component, filearea, itemid.
There are cases when the total number of files fetched using the current get_media_files method can number 100,000 plus. Loading this amount of records into memory can heavily impact page load times.
The solution is to add an additional filter for the filepath so only the records relating for the file being loaded, is loaded into memory. This should never exceed a dozen.
The SQL is still able to take advantage of the existing index made up of fields contextid, component, filearea, itemid.