|
hmm, wouldn't it be easier to add new function that preloads all course related contexts including blocks?
ARGH ***ING BROWSER LOST THIS TEXT WHEN I PRESSED THE WRONG KEY *tries to calm down
Revised patch attached. Gets rid of other changes, makes new function preload_course_contexts which loads (UNION ALL) course context, module contexts, and block contexts (for blocks on course page). Performance seems similar. Changed get_fast_modinfo to call this, also threw in a call at the top of course/view to save a query loading the course context. OK to commit this for 1.9? (Or of course feel free to make more comments...) I may have other changes later - still working on other performance issues with ridiculous number of activities - but figure best to deal with them one at a time. I committed this patch to MOODLE_19.
I'll merge it to HEAD and tag _MERGED later today (need to get other changes committed first). OK, now also committed to HEAD, and tagged (on the branch) MOODLE_19_MERGED. I tested only briefly in HEAD in a 'does the course page still load' kind of way, but that's probably adequate.
reopening, the use of whitespace is not acceptable, sorry - please see http://docs.moodle.org/en/Development:Coding
going to fix it now... Tim - LIKE queries are not indexed in UTF-8 Postgres unless you add extra index; that would perform far worse on a standard Postgres install.
(There is a bug about this for Eloy, but I want to go home not look up the number, sorry!) So at the point when I wrote this, probably the unions were faster. (We do have the special index manually added on OU servers now, for obvious reasons.) If Eloy adds support for xmldb to make the indexes, this would probably only happen in 2.0. Once that happens, yes it would be worth re-evaluating performance of the simple LIKE query against the union, on mysql and postgres - it might perform better [or just the same and with simpler code]. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(Since it is a worthwhile performance improvement imo - ok not many courses have 900 activities, that's a bit of a special case, but we have 25 courses with more than 200...)