Full text search vs LIKE

前端 未结 6 1665
长情又很酷
长情又很酷 2021-02-04 01:45

My question is about using fulltext.As I know like queries which begin with % never use index :

SELECT * from customer where name like %username%
6条回答
  •  长情又很酷
    2021-02-04 02:03

    You have to understand how index is working. Index is the very same like the dead-wood edition of encyclopedia.

    If you use:

    SELECT * from customer where name like username%
    

    The index, in fulltext or no fulltext should work. but

    SELECT * from customer where name like %username%
    

    will never work with index. and it will be time-consuming query.

提交回复
热议问题