MySQL full-text index avoids like inefficiency
Why should we use full-text indexes?
In general, the like Statement of SQL is used for database search, and the like statement cannot use indexes. Each query goes from the first to the last one, and the query efficiency is extremely low. Generally, if the data exceeds 0.1 million or the number of online users is too large, like queries may cause database crashes. This is why many programs only provide title search, because if the content is searched, it will be slower and tens of thousands of data will not run.
Mysql full-text index is designed to solve fuzzy queries. You can index the entire article by words in advance, which is highly efficient in search and supports retrieval of millions of data records.
Full-text index settings
1. system settings: modify my. ini (my. cnf in Linux), add a line "ft_min_word_len = 1" after [mysqld], and restart Mysql.
2. Add full-text indexes to the database and table:
Create fulltext index kn_index_1 on t_knowledge (KeyWord );