overviewfiles is not a mdl_course table field so we need to query mdl_files to see if that filearea has any files. DB reads to mdl_file are not cheap and we should avoid it. We noticed this performance regression when
MDL-63445 got integrated as we have 1 extra db read despite not having course overview files. A possible option is a cache definition, another one (worst I guess) a new field in mdl_course and there may be others. Adding a solution for this would also help us reduce the number of db reads we are currently doing to display other course overview images.