nextcloud / photos

📸 Your memories under your control
GNU Affero General Public License v3.0
517 stars 59 forks source link

AlbumMappper::getForFile is not using an index #2444

Open juliushaertl opened 2 months ago

juliushaertl commented 2 months ago

The following query does not seem ot use an index and do a full table scan on the albums table:

Screenshot 2024-04-22 at 10 17 01

https://github.com/nextcloud/photos/blob/2376b7d81d102272917fec65a4a933a07c3136e0/lib/Album/AlbumMapper.php#L138-L146

From a brief look it should be possible to refactor it to query the oc_photos_albums_files first to then get only the albums using an inner join