Tuesday, March 15, 2011

MySQL: Fulltext indexing previous records?

Hi All,

I added a FULLTEXT index on three of my columns, after I already had a bunch of records...does that mean the FULLTEXT won't index them and will only index records inserted after the FULLTEXT index was added? If so, anyway to reindex the whole database?

From stackoverflow
  • When you do ALTER TABLE ADD INDEX, old records get indexed immediately (and new records get indexed as soon as they are INSERTed). That's true for FULLTEXT indexes as well.

    Please note however, that sometimes (e.g. when you change options ft_min_word_len, ft_max_word_len, or ft_stopword_file) you have to rebuild a FULLTEXT index, see http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html for details.

    Jasie : Thank you for your help! The article was very helpful.
  • It's MySQL's responsibility, not yours, to ensure that indexes are consistent with the data they are indexing.

    When you add an index on existing data, MySQL will build the index according to that existing data.

    FULLTEXT indexes are no exception.

    You should only need to rebuild an index if you suspect your table has been corrupted somehow, or you have done some other advanced tweaking to the way MySQL builds its indexes.

    Jasie : Thank you for your help!

0 comments:

Post a Comment