我有以下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
它抛出
SQLite warning (284): automatic index on sqlite_sq_BD26FF8(GenreId)
MovieGenres.GenreId
确实有一个索引,GenreImages.GenreId
也是如此。此警告来自子查询GenreMoviesPlayCounts.GenreId = Genre.Id
。
有没有更好的方法来使用我现有的索引或不需要子查询?