I have the following SQL
SELECT *
FROM Genres, GenreImages
LEFT JOIN
(SELECT SUM(Movies.PlayCount) AS SummedPlayCounts, MovieGenres.GenreId
FROM Movies, MovieGenres
WHERE Movies.Id = MovieGenres.MovieId
GROUP BY MovieGenres.GenreId
ORDER BY SummedPlayCounts DESC) AS GenreMoviesPlayCounts
ON GenreMoviesPlayCounts.GenreId = Genre.Id
WHERE GenreImages.GenreId = Genres.Id
AND GenreImages.PrimaryImage = 1
it throws
SQLite warning (284): automatic index on sqlite_sq_BD26FF8(GenreId)
MovieGenres.GenreId does have an index, as does GenreImages.GenreId. This warning is coming from the subquery GenreMoviesPlayCounts.GenreId = Genre.Id.
Is there a better way to do this that makes use of my existing index or doesn't need a sub query?
Aucun commentaire:
Enregistrer un commentaire