Mysql: 21 best practices for performance optimization 4 [index search fields]
Mysql: 21 performance optimization best practices 4 [index search fields] _ MySQL
Create an index for a search field
An index is not necessarily a primary key or a unique field. If a field in your table is always used for search, create an index for it.
You can see the search string "last_name LIKE 'a % '". one is an index, the other is no index, and the performance is about 4 times worse.
In addition, you should also know what kind of search cannot use normal indexes. For example, if you need to search for a word in a large article, for example, "WHERE post_content LIKE '% apple %'", the index may be meaningless. You may need to use MySQL full-text indexes or make an index yourself (for example, search for keywords or tags ).
The above is mysql: 21 best practices for performance optimization 4 [create an index for a search field] _ MySQL content. For more information, see The PHP Chinese network (www.php1.cn )!