Mysql Improve Search Performance with wildcards (%%)

后端 未结 6 772
青春惊慌失措
青春惊慌失措 2020-11-30 10:24

Below is a query I use for searching a person by email

  SELECT *
    FROM phppos_customers
    JOIN phppos_people ON phppos_customers.person_id = phppos_peo         


        
6条回答
  •  时光说笑
    2020-11-30 10:52

    I know how to outsmart mysql and enable the index search even when wild card searching from the left side. Just create a reversed column of your column (make it an index), reverse also the search string, and use the wildcard from right side which has the index support..

    So if you have in db word "slibro" and you want search "%libro", created reversed column will contain "orbils" and search will be "orbil%".

    PS: But don't have the solution how to do fast full wildcard search "%x%" though :).

提交回复
热议问题