I am not sure if i need to create an index with multiple columns or an index for each of the columns used.
I am also not sure whether to use desc or asc on the field indexed
SELECT * from movie
where year > 1892 AND year < 2015 AND genre like '%Adventure%' AND genre like '%Comedy%'
AND genre like '%Mystery%' AND imdbRating > 5.9 AND imdbvotes > 99 AND type = 'movie'
genre is a varch and looks like 'action, comedy, horror,
This question is impossible to answer well. The reasonableness of index creation results from the data that we draw from the query. The index should be created for the columns of the table, which query did not use more than 10-15% of the rows, then it applies the optimization. In this regard, see which of the columns meets this condition, and create an index on it.
在没有其他信息的情况下:(年份,类型,imdbrating,imdbvotes)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.