Duplicate xengallery_media would benefit from index on album_id

thedude

Well-known member
XenGallery_Model_Media::getMediaForAlbumCache gets crushed by the lack of an album_id index when you run a rebuild on album thumbnails (we have 17,000+ albums). Adding the index for album_id on table xengallery_media makes it much faster.

Also when viewing a user's album, XenGallery_Model_Media::countMedia gets called with the following query:
Code:
SELECT COUNT(*)
FROM xengallery_media AS media

WHERE (media.album_id = 12345) AND (media.media_state IN ('visible','deleted'))

That query currently has to scan every row in the table because there's no index on album_id.
 
Top Bottom