I have a fulltext index on column "SEARCH". But the query contains additional "AND" condition where tinyint column "VEGETARIAN" is involved.
What is the best solution for this situation? To leave as it is - fulltext index just on "SEARCH" column? To create one more index on "VEGETARIAN" column?
$result = mysql_query( "SELECT title FROM recipes where
match(search) against('$query' in boolean mode) and vegetarian='1'
开发者_StackOverflow中文版limit $start, $step");
Thanks.
The extra index on vegetarian would make things faster if less than 50% of the rows have vegetarian = 1
I doubt indexing vegetarian will have any effect as the text search will have to be run first and then the non vegetarian rows filtered out. Best way with this kind of thing is try it and see if it works.
精彩评论