Courses . net/c# Course [4]:sqlserver Basic application Development from the basis for you to explain the relevant use of the data table, and the index in the data table is a necessary grasp :
How to add
Selectipfromtabelxwhereiplike '%192.168.0.1% '
This sentence is optimized for performance.
Indeed, using the like%x, the database has no way to use the index, it is bound to scan the whole table, so we need to avoid this method. My former colleague asked me to try the match () against method. So I tried it by the way,
Full-text indexing only supports MyISAM tables
Select*from ' data '. ' Test ' Wherematch (IP) against (' 192 ')
So the search came out with no results. Google for a while, found that online examples are search English words, so in the IP mixed a little English words tried, there is the result.
After Google found, MySQL default to full-text search has the word character limit, that is:
Ft_max_word_len 84
Ft_min_word_len 4
So the ip here can't be searched because of the. Separated will be treated as a word, IP only 3 bits.
So I changed the Ft_min_word_len to 1, restarted the service, repaired the table, rebuilt the index, and the search succeeded.
This is not a supported search IP,IP search generally saves the IP address into UNSIGNED INT and then searches with the conversion function.
Database full-text indexing related issues