feincms/feincms — Issue #229: MediaFileTranslations create O(n) queries
Author: tino
Created: 2011-11-29 12:30:09+00:00
State: open

MediaFileTranslations are causing O(n) queries on every (!) page in the admin atm. This is because all registered content types are loaded on an admin media page, even if they are not used in the currently selected template, and the __unicode__ method of MediaFile get's the current translation.

I am aware of the current caching that translations.py does, but I don't think that is the correct fix for this problem, merely a workaround. There is a 'fix' for postgres with a subquery (https://github.com/feincms/feincms/blob/898f3645f94df1675c38e383ef45f76f632e735f/feincms/module/medialibrary/models.py#L462), but that is only for postgres.

Maybe there is the possibility to do this with a semi-raw query, that also fetches the current translation in a JOIN? What are the current thoughts on this?