sql - MySQL Innodb Full text Proximity Search Gives Horrible Performance -
i have mysql database simple table named item. item contains following fields , has 55,000 records:
id (pk) description (innodb full text) date
by design forced index way down 1 character words since descriptions contain names such item 1 2 42 spaces must kept intact. running full text search against table , here results following code:
select id, description, date item date > date_sub(now(), interval 15 month) , description concat('%item 1 2 4%') , match (description) against ('+item +1 +2 +a +4' in boolean mode);
this query returns in 1.2 seconds. however, once add following proximity search query return time goes through roof:
select id, description, date item date > date_sub(now(), interval 15 month) , description ('%item%') , match (description) against ('+item +1 +2 +a +4' in boolean mode) , match (description) against ('"1 2 4" @30' in boolean mode);
this query returns in 54 seconds! proximity search must query since need make sure find "item 1 2 a" , not "item 1 2 48884848 222 a" totally different. proximity search runs lot better when words more 1 characters, there circumstances call user typing in 1 character words. there else can alternative proximity searching of full-text innodb have better performance? if there nothing else in mysql, open using integrate give me better proximity search (i on windows though).
thanks!
the like
condition defeats full-text indexes. replace condition
description concat('%item 1 2 4%') -- , why concat() anyways?
... with
match (description) against ('"item 1 2 4"' in boolean mode)
your second condition useless overlaps first condition (you have filtered exact string "item 1 2 4", these rows match '+item +1 +2 +a +4').
Comments
Post a Comment